infocategory = $infocategory; $this->infobject = $infobject; $this->icon = $icon; } /** * Returns count of infobject. * * @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.infocategory.gadget', $count = 10) { if (User::hasRole('user')) { $this->infocategory->pushCriteria(new \Litepie\Btravel\Repositories\Criteria\InfocategoryUserCriteria()); } $infocategory = $this->infocategory->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('infobject::' . $view, compact('infocategory'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.infobject.gadget', $count = 10) { if (User::hasRole('user')) { $this->infobject->pushCriteria(new \Litepie\Btravel\Repositories\Criteria\InfobjectUserCriteria()); } $infobject = $this->infobject->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('infobject::' . $view, compact('infobject'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.icon.gadget', $count = 10) { if (User::hasRole('user')) { $this->icon->pushCriteria(new \Litepie\Btravel\Repositories\Criteria\IconUserCriteria()); } $icon = $this->icon->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('infobject::' . $view, compact('icon'))->render(); } }