M
M
marq2019-08-21 17:23:12
Laravel
marq, 2019-08-21 17:23:12

How to add data from one table to another in Laravel?

There are two tables table1 and table2 with identical fields. It is necessary to transfer the data from table1 to table2 on the button from the form.
I wrote something like this in the controller:

$t=Table1::all();
           Table2::create($t);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
serginhold, 2019-08-21
@marq

this is the simplest sql query
https://www.w3schools.com/sql/sql_insert_into_sele...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question