@@ -7,41 +7,41 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Authenticate |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * The authentication guard factory instance. |
|
| 12 | - * |
|
| 13 | - * @var \Illuminate\Contracts\Auth\Factory |
|
| 14 | - */ |
|
| 15 | - protected $auth; |
|
| 10 | + /** |
|
| 11 | + * The authentication guard factory instance. |
|
| 12 | + * |
|
| 13 | + * @var \Illuminate\Contracts\Auth\Factory |
|
| 14 | + */ |
|
| 15 | + protected $auth; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Create a new middleware instance. |
|
| 19 | - * |
|
| 20 | - * @param \Illuminate\Contracts\Auth\Factory $auth |
|
| 21 | - */ |
|
| 22 | - public function __construct(Auth $auth) |
|
| 23 | - { |
|
| 24 | - $this->auth = $auth; |
|
| 25 | - } |
|
| 17 | + /** |
|
| 18 | + * Create a new middleware instance. |
|
| 19 | + * |
|
| 20 | + * @param \Illuminate\Contracts\Auth\Factory $auth |
|
| 21 | + */ |
|
| 22 | + public function __construct(Auth $auth) |
|
| 23 | + { |
|
| 24 | + $this->auth = $auth; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Handle an incoming request. |
|
| 29 | - * |
|
| 30 | - * @param \Illuminate\Http\Request $request |
|
| 31 | - * @param \Closure $next |
|
| 32 | - * @param string|null $guard |
|
| 33 | - * @return mixed |
|
| 34 | - */ |
|
| 35 | - public function handle($request, Closure $next, $guard = null) |
|
| 36 | - { |
|
| 37 | - if ($this->auth->guard($guard)->guest()) { |
|
| 38 | - return response()->json(['message' => 'authentication-needed'], 401); |
|
| 39 | - } |
|
| 27 | + /** |
|
| 28 | + * Handle an incoming request. |
|
| 29 | + * |
|
| 30 | + * @param \Illuminate\Http\Request $request |
|
| 31 | + * @param \Closure $next |
|
| 32 | + * @param string|null $guard |
|
| 33 | + * @return mixed |
|
| 34 | + */ |
|
| 35 | + public function handle($request, Closure $next, $guard = null) |
|
| 36 | + { |
|
| 37 | + if ($this->auth->guard($guard)->guest()) { |
|
| 38 | + return response()->json(['message' => 'authentication-needed'], 401); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - if ($request->user()->isBanned == true) { |
|
| 42 | - return response('Unauthorized.', 401); |
|
| 43 | - } |
|
| 41 | + if ($request->user()->isBanned == true) { |
|
| 42 | + return response('Unauthorized.', 401); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return $next($request); |
|
| 46 | - } |
|
| 45 | + return $next($request); |
|
| 46 | + } |
|
| 47 | 47 | } |
| 48 | 48 | \ No newline at end of file |
@@ -1,30 +1,30 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Http\Middleware; |
|
| 3 | + namespace App\Http\Middleware; |
|
| 4 | 4 | |
| 5 | -use Closure; |
|
| 6 | -use Illuminate\Contracts\Auth\Factory as Auth; |
|
| 5 | + use Closure; |
|
| 6 | + use Illuminate\Contracts\Auth\Factory as Auth; |
|
| 7 | 7 | |
| 8 | -class Authenticate |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class Authenticate |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * The authentication guard factory instance. |
| 12 | 12 | * |
| 13 | 13 | * @var \Illuminate\Contracts\Auth\Factory |
| 14 | 14 | */ |
| 15 | - protected $auth; |
|
| 15 | + protected $auth; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Create a new middleware instance. |
| 19 | 19 | * |
| 20 | 20 | * @param \Illuminate\Contracts\Auth\Factory $auth |
| 21 | 21 | */ |
| 22 | - public function __construct(Auth $auth) |
|
| 23 | - { |
|
| 24 | - $this->auth = $auth; |
|
| 25 | - } |
|
| 22 | + public function __construct(Auth $auth) |
|
| 23 | + { |
|
| 24 | + $this->auth = $auth; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | + /** |
|
| 28 | 28 | * Handle an incoming request. |
| 29 | 29 | * |
| 30 | 30 | * @param \Illuminate\Http\Request $request |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | * @param string|null $guard |
| 33 | 33 | * @return mixed |
| 34 | 34 | */ |
| 35 | - public function handle($request, Closure $next, $guard = null) |
|
| 36 | - { |
|
| 37 | - if ($this->auth->guard($guard)->guest()) { |
|
| 38 | - return response()->json(['message' => 'authentication-needed'], 401); |
|
| 39 | - } |
|
| 35 | + public function handle($request, Closure $next, $guard = null) |
|
| 36 | + { |
|
| 37 | + if ($this->auth->guard($guard)->guest()) { |
|
| 38 | + return response()->json(['message' => 'authentication-needed'], 401); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - if ($request->user()->isBanned == true) { |
|
| 42 | - return response('Unauthorized.', 401); |
|
| 43 | - } |
|
| 41 | + if ($request->user()->isBanned == true) { |
|
| 42 | + return response('Unauthorized.', 401); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return $next($request); |
|
| 46 | - } |
|
| 45 | + return $next($request); |
|
| 46 | + } |
|
| 47 | 47 | } |
| 48 | 48 | \ No newline at end of file |