Esempio n. 1
0
 /**
  * Displays all issues.
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $user = Auth::user();
     $model = $this->issue->open();
     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'));
 }
Esempio n. 2
0
 /**
  * Bind data to the view.
  *
  * @param View $view
  */
 public function compose(View $view)
 {
     $user = Auth::user();
     // Check for the user instance due to the layout
     // navigation being composed by guests as well.
     if ($user instanceof User) {
         $query = $issues = $this->issue->open();
         if ($user->cannot('manage.issues')) {
             $query = $query->forUser($user);
         }
         $view->with(['issues' => $query->count()]);
     }
 }
Esempio n. 3
0
 /**
  * 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()]);
 }