提交表单后,它显示“ 419 |页面已过期”。我在表单中使用了@csrf
,并在我的本地服务器上使用它。但是,我在实时服务器上面临该问题。有什么帮助吗?我有三种类型的用户,并为他们实现了多重身份验证。该表单甚至都不会发布到Controller。
config / auth.php
return [
'defaults' => [
'guard' => 'vendor',
'passwords' => 'vendors',
],
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
'manager' => [
'driver' => 'session',
'provider' => 'managers',
],
'vendor' => [
'driver' => 'session',
'provider' => 'vendors',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
'hash' => false,
],
],
'providers' => [
'admins' => [
'driver' => 'eloquent',
'model' => App\Admin::class,
],
'managers' => [
'driver' => 'eloquent',
'model' => App\Manager::class,
],
'vendors' => [
'driver' => 'eloquent',
'model' => App\Vendor::class,
],
],
'passwords' => [
'admins' => [
'provider' => 'admins',
'table' => 'password_resets',
'expire' => 60,
],
'managers' => [
'provider' => 'managers',
'table' => 'password_resets',
'expire' => 60,
],
'vendors' => [
'provider' => 'vendors',
'table' => 'password_resets',
'expire' => 60,
],
],
];
RedirectedIfAuthenticated.php
<?php
public function handle($request, Closure $next, $guard = null)
{
switch ($guard) {
case 'admin':
if (Auth::guard($guard)->check()) {
return redirect()->route('admin.dashboard');
}
break;
case 'manager':
if (Auth::guard($guard)->check()) {
return redirect()->route('manager.dashboard');
}
break;
case 'vendor':
if (Auth::guard($guard)->check()) {
return redirect()->route('vendor.dashboard');
}
break;
default:
if (Auth::guard($guard)->check()) {
return redirect('/home');
}
break;
}
return $next($request);
}