如何在Laravel中转换此查询?

时间:2018-08-23 09:54:41

标签: laravel eloquent

如何将该查询转换为laravel形式?

enter image description here

1 个答案:

答案 0 :(得分:1)

类似的东西:

Stocks::where('shop_id', $client_id)
->where(function ($query) use ($client_id, $ware_cd) {
    $query->where('ware_id',
    DB::raw(
     'select ware_id from t_ware where shop_id=' . $client_id . ' and ware_cd=' . $ware_cd
     )
   );
})
->distinct()
->get();