/** * Displays all closed issues. * * @return \Illuminate\View\View */ public function closed() { $user = Auth::user(); $model = $this->issue->closed(); if ($user->cannot('manage.issues')) { $model = $model->forUser($user); } $issues = $this->presenter->table($model); $labels = $this->label->all(); $navbar = $this->presenter->navbar($labels); return view('pages.issues.index', compact('issues', 'navbar')); }
/** * Bind data to the view. * * @param View $view */ public function compose(View $view) { $user = Auth::user(); $open = $this->issue->open(); $closed = $this->issue->closed(); if ($user->cannot('manage.issues')) { // If the user doesn't have permission to view all issues, we // need to scope the query by the current user to only // show the users issue count. $open->forUser($user); $closed->forUser($user); } $view->with(['open' => $open->count(), 'closed' => $closed->count()]); }