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