profile = $profile; $this->visit = $visit; $this->shortlist = $shortlist; $this->request = $request; } /** * Returns count of profile. * * @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.profile.gadget', $count = 10) { if (User::hasRole('user')) { $this->profile->pushCriteria(new \Litepie\Litematrimony\Repositories\Criteria\ProfileUserCriteria()); } $profile = $this->profile->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('profile::' . $view, compact('profile'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.visit.gadget', $count = 10) { if (User::hasRole('user')) { $this->visit->pushCriteria(new \Litepie\Litematrimony\Repositories\Criteria\VisitUserCriteria()); } $visit = $this->visit->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('profile::' . $view, compact('visit'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.shortlist.gadget', $count = 10) { if (User::hasRole('user')) { $this->shortlist->pushCriteria(new \Litepie\Litematrimony\Repositories\Criteria\ShortlistUserCriteria()); } $shortlist = $this->shortlist->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('profile::' . $view, compact('shortlist'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.request.gadget', $count = 10) { if (User::hasRole('user')) { $this->request->pushCriteria(new \Litepie\Litematrimony\Repositories\Criteria\RequestUserCriteria()); } $request = $this->request->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('profile::' . $view, compact('request'))->render(); } }