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