在我的情况下,我想显示每个用户完成的用户和订单,订单有状态我从输入表单获得$ status这里是我的代码
$orders = DB::table('user_profiles')
->leftJoin('orders', function($join){
$join->on('user_profiles.id','=','orders.id_user')
->where('orders.status','=',$status);
})
->selectRaw('user_profiles.*, count(orders.id_user) as order_try_count')
->groupBy('user_profiles.id')
->orderBy('order_try_count',$order)
->paginate(15);
Run Code Online (Sandbox Code Playgroud)
但我得到未定义的变量状态,我该怎么做才能解决这个问题?,谢谢