$departments = Order::join('categories', 'orders.category_id', '=', 'categories.id') ->join('departments', 'categories.department_id', '=', 'departments.id') ->select('departments.name') ->where(function($query) use ($date_from, $date_to) { $query->whereBetween('created_at', [ $date_from." 00:00:00" , $date_to." 23:59:59" ]); }) ->groupBy('categories.department_id') ->selectRaw('count(*) as total') ->get();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire