Snipe-IT
Open Source Asset Management
FEATURES
DEMO
DOWNLOAD
DOCUMENTATION
HOSTED SOLUTION
SUPPORT
Intro
Namespaces
Classes
Files
Misc
snipe-it
app
Http
Middleware
Authenticate.php
Go to the documentation of this file.
1
<?php
2
3
namespace
App\Http\Middleware
;
4
5
use
Closure
;
6
use
Illuminate\Contracts\Auth\Guard
;
7
8
class
Authenticate
9
{
15
protected
$auth
;
16
23
public
function
__construct
(Guard
$auth
)
24
{
25
$this->auth =
$auth
;
26
}
27
35
public
function
handle
($request,
Closure
$next)
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
}
47
}
Closure
App\Http\Middleware\Authenticate\handle
handle($request, Closure $next)
Handle an incoming request.
Definition:
Authenticate.php:35
App\Http\Middleware
Definition:
Authenticate.php:3
App\Http\Middleware\Authenticate\$auth
$auth
Definition:
Authenticate.php:15
Guard
App\Http\Middleware\Authenticate
Definition:
Authenticate.php:8
App\Http\Middleware\Authenticate\__construct
__construct(Guard $auth)
Create a new filter instance.
Definition:
Authenticate.php:23