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