A
A
axblue2017-01-09 00:32:08
Laravel
axblue, 2017-01-09 00:32:08

How to attach to the created record?

Hello. Tell me how to attach a record to the link table of the record being created. More precisely, you need to create a record in (table1) and immediately attach a record from (table2) to it. Communication is set up. table exists. Everything works, but I don’t know how to attach the id of the created record in (table1) to the table2 record.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
axblue, 2017-01-09
@leshikgo

Understood. It turns out that after save() the id of the current record being created is itself assigned.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question