in my case, i want to display orders completed by certain user, with certain time range, here is my code
$orders = DB::table('user_profiles')
->leftJoin('orders', function($join) use ($status,$order){
$join->on('user_profiles.id','=','orders.id_user')
->where('orders.status','=',$status)
->whereBetween('orders.created_at',[$from,$to]);
})
->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 Call to undefined method Illuminate\Database\Query\JoinClause::whereBetween(), what should i do to solve this ? thank you so much...
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TnsP65
via IFTTT
Aucun commentaire:
Enregistrer un commentaire