kitchen = $kitchen; $this->kitchen_category = $kitchen_category; $this->kitchen_comment = $kitchen_comment; $this->kitchen_tag = $kitchen_tag; } /** * Returns count of kitchen_blog. * * @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.kitchen.gadget', $count = 10) { if (User::hasRole('user')) { $this->kitchen->pushCriteria(new \Litepie\Litecms\Repositories\Criteria\KitchenUserCriteria()); } $kitchen = $this->kitchen->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('kitchen_blog::' . $view, compact('kitchen'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.kitchen_category.gadget', $count = 10) { if (User::hasRole('user')) { $this->kitchen_category->pushCriteria(new \Litepie\Litecms\Repositories\Criteria\KitchenCategoryUserCriteria()); } $kitchen_category = $this->kitchen_category->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('kitchen_blog::' . $view, compact('kitchen_category'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.kitchen_comment.gadget', $count = 10) { if (User::hasRole('user')) { $this->kitchen_comment->pushCriteria(new \Litepie\Litecms\Repositories\Criteria\KitchenCommentUserCriteria()); } $kitchen_comment = $this->kitchen_comment->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('kitchen_blog::' . $view, compact('kitchen_comment'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.kitchen_tag.gadget', $count = 10) { if (User::hasRole('user')) { $this->kitchen_tag->pushCriteria(new \Litepie\Litecms\Repositories\Criteria\KitchenTagUserCriteria()); } $kitchen_tag = $this->kitchen_tag->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('kitchen_blog::' . $view, compact('kitchen_tag'))->render(); } }