请教 eloquent 中 update 构造器的值指定的表名.字段名应该怎么写?
关联table1,table2,把符合条件table1.price的值更新为table2.price的值 table1::join('table2', 'table1.id', '=', 'table2.id) ->where('table1.price', '<', 'table.price') ->update([ 'table1.price' => 'table2.price' ]);
尝试这样写'table2.price'为这串字符串,不是表.字段名
使用`包裹或者'table1.price=>DB::Raw('table2.price')
同样不行
请问怎样才能让update的值设定为表.字段名而不是字符串。
推荐文章: