/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // first, handle the closure, and save it for later.
     $closureResult = $next($request);
     //now in the middle, as long as the user is logged in (created)
     if ($this->auth->check()) {
         //make the user default to a end user
         $endUserRole = Role::description('user')->get()->first();
         $endUserRole->users()->attach($this->auth->user());
     }
     return $closureResult;
 }
Beispiel #2
0
 public static function getAdmin()
 {
     return Role::description('admin')->get()->first();
 }