App\Http\Middleware\Authenticate Class Reference

Public Member Functions

 __construct (Guard $auth)
 Create a new filter instance. More...
 
 handle ($request, Closure $next)
 Handle an incoming request. More...
 

Protected Attributes

 $auth
 

Detailed Description

Definition at line 8 of file Authenticate.php.

Constructor & Destructor Documentation

App\Http\Middleware\Authenticate::__construct ( Guard  $auth)

Create a new filter instance.

Parameters
Guard$auth
Returns
void

Definition at line 23 of file Authenticate.php.

24  {
25  $this->auth = $auth;
26  }

Member Function Documentation

App\Http\Middleware\Authenticate::handle (   $request,
Closure  $next 
)

Handle an incoming request.

Parameters
\Illuminate\Http\Request$request
\Closure$next
Returns
mixed

Definition at line 35 of file Authenticate.php.

36  {
37  if ($this->auth->guest()) {
38  if ($request->ajax()) {
39  return response('Unauthorized.', 401);
40  } else {
41  return redirect()->guest('login');
42  }
43  }
44 
45  return $next($request);
46  }

Member Data Documentation

App\Http\Middleware\Authenticate::$auth
protected

Definition at line 15 of file Authenticate.php.


The documentation for this class was generated from the following file: