mercredi 21 juin 2017

Laravel insert collection in db

I have retrieved some data from db using:

$filtered = DB::table('tmp_table')->distinct()->select('type','description','note')->get();

and I would like to insert what I have retrieved in another table like:

DB::table('tmp_other')->insert($filtered);

but I receive thie error:

Type error: Argument 1 passed to Illuminate\Database\Query\Builder::insert() must be of the type array, object given

which is the best way to do this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2sARo6I
via IFTTT

Aucun commentaire:

Enregistrer un commentaire