laravel 查询时添加指定的字段并赋值
2019-12-13 本文已影响0人
南风志
$wh_id ='指定的值';
$data =Goods::select('*',\DB::raw("$wh_id as wh_id"))->where(['goods_id'=>$request->get('goods_id')])
->with(['goods_group_info'=>function($query){
$query->select('*',\DB::raw('goods_id use_total'));
return $query;
}])->get();