예제 #1
0
 /**
  * Constrain a roles query by the given user.
  *
  * @param  \Illuminate\Database\Eloquent\Model  $user
  * @return \Illuminate\Database\Eloquent\Builder
  */
 protected function buildPermissionRolesQuery(Model $user)
 {
     $roles = $user->roles;
     return Permission::whereHas('roles', function ($query) use($roles) {
         return $query->whereIn('roles.id', $roles->lists('id')->all());
     });
 }