0
$table = 'favorite_contents';
$contents = DB::table($table)
->join('contents', function($join) use($table){
$join->on("$table.content_id", '=', 'contents.id');
})
->whereIn("$table.content_id",$ids)
->update(array(
"$table.expired" => 1,
"$table.type" => "contents.type"
));
"$table.expired" => 1
工作正常,但"$table.type" => "contents.type"
没有。更新table1字段中的表2字段值加入laravel流利
所以这个问题与在内容表中获取类型的值有关,如何在不诉诸foreach的情况下做到这一点?