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