예제 #1
0
 /**
  * Returns a complete list of roles that this user may delegate to others.
  *
  * @param  Board|null  $board  If not null, will refine search to a single board.
  * @return Collection|array
  */
 public function getAssignableRoles(Board $board = null)
 {
     return $board->roles()->where(function ($query) use($board) {
         if (is_null($board) && $this->canAdminRoles()) {
             $query->whereStaff();
         } else {
             if ($this->can('board.user.role', $board)) {
                 $query->whereJanitor();
             }
         }
     })->get();
 }