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