dimanche 2 juin 2019

419 page expired Laravel 5.8 after login/registraion in live server

after form submit for login/registration it shows 419|page expired. I used @csrf in the form. Its working on local server. but facing the issue in live server. Any help? I have different 3 types of users and implemented multi auth for them. My code is given below:

config/auth.php

<?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,
        ],

        // 'users' => [
        //     'driver' => 'database',
        //     'table' => 'users',
        // ],
    ],

    '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

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);
    }

its perfectly working locally except on live server. pls help.



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2Icbtsz
via IFTTT

Aucun commentaire:

Enregistrer un commentaire