restaurant = $restaurant; $this->addon = $addon; $this->category = $category; $this->menu = $menu; $this->review = $review; } /** * Returns count of restaurant. * * @param array $filter * * @return int */ public function count() { return 0; } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.restaurant.gadget', $count = 10) { if (User::hasRole('user')) { $this->restaurant->pushCriteria(new \Litepie\Restaurant\Repositories\Criteria\RestaurantUserCriteria()); } $restaurant = $this->restaurant->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('restaurant::' . $view, compact('restaurant'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.addon.gadget', $count = 10) { if (User::hasRole('user')) { $this->addon->pushCriteria(new \Litepie\Restaurant\Repositories\Criteria\AddonUserCriteria()); } $addon = $this->addon->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('restaurant::' . $view, compact('addon'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.category.gadget', $count = 10) { if (User::hasRole('user')) { $this->category->pushCriteria(new \Litepie\Restaurant\Repositories\Criteria\CategoryUserCriteria()); } $category = $this->category->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('restaurant::' . $view, compact('category'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.menu.gadget', $count = 10) { if (User::hasRole('user')) { $this->menu->pushCriteria(new \Litepie\Restaurant\Repositories\Criteria\MenuUserCriteria()); } $menu = $this->menu->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('restaurant::' . $view, compact('menu'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.review.gadget', $count = 10) { if (User::hasRole('user')) { $this->review->pushCriteria(new \Litepie\Restaurant\Repositories\Criteria\ReviewUserCriteria()); } $review = $this->review->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('restaurant::' . $view, compact('review'))->render(); } }