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