comment = $comment; $this->page = $page; $this->project = $project; $this->roadmap = $roadmap; $this->sprint = $sprint; $this->worklog = $worklog; } /** * Returns count of pm. * * @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.comment.gadget', $count = 10) { if (User::hasRole('user')) { $this->comment->pushCriteria(new \Litepie\Project\Repositories\Criteria\CommentUserCriteria()); } $comment = $this->comment->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('pm::' . $view, compact('comment'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.page.gadget', $count = 10) { if (User::hasRole('user')) { $this->page->pushCriteria(new \Litepie\Project\Repositories\Criteria\PageUserCriteria()); } $page = $this->page->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('pm::' . $view, compact('page'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.project.gadget', $count = 10) { if (User::hasRole('user')) { $this->project->pushCriteria(new \Litepie\Project\Repositories\Criteria\ProjectUserCriteria()); } $project = $this->project->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('pm::' . $view, compact('project'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.roadmap.gadget', $count = 10) { if (User::hasRole('user')) { $this->roadmap->pushCriteria(new \Litepie\Project\Repositories\Criteria\RoadmapUserCriteria()); } $roadmap = $this->roadmap->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('pm::' . $view, compact('roadmap'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.sprint.gadget', $count = 10) { if (User::hasRole('user')) { $this->sprint->pushCriteria(new \Litepie\Project\Repositories\Criteria\SprintUserCriteria()); } $sprint = $this->sprint->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('pm::' . $view, compact('sprint'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.worklog.gadget', $count = 10) { if (User::hasRole('user')) { $this->worklog->pushCriteria(new \Litepie\Project\Repositories\Criteria\WorklogUserCriteria()); } $worklog = $this->worklog->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('pm::' . $view, compact('worklog'))->render(); } }