我从检索到的一些数据DB使用:Laravel插入收集分贝
$filtered = DB::table('tmp_table')->distinct()->select('type','description','note')->get();
,我想插入我像另一个表已检索:
DB::table('tmp_other')->insert($filtered);
,但我收到thie错误:
Type error: Argument 1 passed to Illuminate\Database\Query\Builder::insert() must be of the type array, object given
这是最好的方法来做到这一点?
'DB :: table('tmp_other') - > insert($ filtered-> toArray());'应该有效。 – Daan
@StefanoMaglione好......你明白了,错误信息中写了什么? –
Eloquent标签在这里不适用吗? – apokryfos