question = $question; $this->dimension = $dimension; $this->tag = $tag; $this->template = $template; $this->roption = $roption; } /** * Returns count of question. * * @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.question.gadget', $count = 10) { if (User::hasRole('user')) { $this->question->pushCriteria(new \Litepie\Survey\Repositories\Criteria\QuestionUserCriteria()); } $question = $this->question->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('question::' . $view, compact('question'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.dimension.gadget', $count = 10) { if (User::hasRole('user')) { $this->dimension->pushCriteria(new \Litepie\Survey\Repositories\Criteria\DimensionUserCriteria()); } $dimension = $this->dimension->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('question::' . $view, compact('dimension'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.tag.gadget', $count = 10) { if (User::hasRole('user')) { $this->tag->pushCriteria(new \Litepie\Survey\Repositories\Criteria\TagUserCriteria()); } $tag = $this->tag->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('question::' . $view, compact('tag'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.template.gadget', $count = 10) { if (User::hasRole('user')) { $this->template->pushCriteria(new \Litepie\Survey\Repositories\Criteria\TemplateUserCriteria()); } $template = $this->template->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('question::' . $view, compact('template'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.roption.gadget', $count = 10) { if (User::hasRole('user')) { $this->roption->pushCriteria(new \Litepie\Survey\Repositories\Criteria\RoptionUserCriteria()); } $roption = $this->roption->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('question::' . $view, compact('roption'))->render(); } }