source: app/Http/Middleware/Authenticate.php

Last change on this file was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 2 years ago
  • Initial commit;
  • Property mode set to 100644
File size: 594 bytes
RevLine 
[dfae77e]1<?php
2
3namespace App\Http\Middleware;
4
5use Illuminate\Auth\Middleware\Authenticate as Middleware;
6
7class Authenticate extends Middleware
8{
9 /**
10 * Get the path the user should be redirected to when they are not authenticated.
11 *
12 * @param \Illuminate\Http\Request $request
13 * @return string|null
14 */
15 protected function redirectTo($request)
16 {
17 if ($request->expectsJson()) {
18 return response()->json(['error' => 'Unauthenticated.'], 401);
19 }
20
21 if (! $request->expectsJson()) {
22 return route('login');
23 }
24 }
25}
Note: See TracBrowser for help on using the repository browser.