/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $groupOption = "food"; $menuOption = "dishes"; $restaurant = Restaurant::where('user_id', Auth::user()->id)->first(); $dishes = Dish::where('restaurant_id', $restaurant->id)->get(); return view('backend.pages.dishes')->with(compact('dishes', 'menuOption', 'groupOption')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $menuOption = "analitics"; $restaurant = Restaurant::where('user_id', Auth::user()->id)->first(); $dishes = Dish::where('restaurant_id', $restaurant->id)->get(); $categories = Category::where('restaurant_id', $restaurant->id)->get(); $dishesIds = Dish::where('restaurant_id', $restaurant->id)->lists('id'); $categoriesIds = Category::where('restaurant_id', $restaurant->id)->lists('id'); $dishesAnalytics = Analitic::where('related_table', 'dishes')->whereIn('related_id', $dishesIds)->get(); $firstDay = Analitic::where('related_table', 'dishes')->whereIn('related_id', $dishesIds)->min('date'); $categoriesAnalytics = Analitic::where('related_table', 'categories')->whereIn('related_id', $categoriesIds)->get(); return view('backend.pages.analitics')->with(compact('dishesAnalytics', 'menuOption')); }