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