Arvind Kapse Arvind Kapse - 1 year ago 475
PHP Question

Copy one table to another in laravel 5

How do i use the following insert into query in laravel 5?

INSERT INTO connection2.table (SELECT * from connection1.table);

I am looking for two different connections, Connection1.table record should goes to Connection2.table.

Answer Source


$c1 = DB("Connection1")->select("SELECT * from table")

foreach($c1 as $record){