v2board/app/Http/Middleware/Authenticate.php

22 lines
461 B
PHP
Raw Normal View History

2019-10-29 15:33:36 +08:00
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
2020-01-11 13:36:52 +08:00
* @param \Illuminate\Http\Request $request
2019-10-29 15:33:36 +08:00
* @return string
*/
protected function redirectTo($request)
{
2020-01-11 13:36:52 +08:00
if (!$request->expectsJson()) {
2019-10-29 15:33:36 +08:00
return route('login');
}
}
}