mardi 17 mai 2016

Undefined variable inside laravel left join

in my case, i want to display users and orders completed by each user, orders have status i get $status from input form here is my code

$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);

but i get undefined variable status, what should i do to solve this problem ?, thank you



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1qsOy0V
via IFTTT

Aucun commentaire:

Enregistrer un commentaire