- Make all tests pass Client (V4),CRMV2,CRMV4 - Simplify client submodule path - Move App_url to .env.testing
32 lines
736 B
PHP
32 lines
736 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Session;
|
|
|
|
/**
|
|
* Updated for ApiV4.
|
|
*/
|
|
class Authenticate extends Middleware
|
|
{
|
|
/**
|
|
* Get the path the user should be redirected to when they are not authenticated.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return string|null
|
|
*
|
|
*/
|
|
protected function redirectTo(Request $request): ?string
|
|
{
|
|
if (!$request->expectsJson()) {
|
|
// * Notify must login
|
|
Session::flash('warning', trans('Veuillez vous connecter pour continuer'));
|
|
|
|
return route('login');
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|