lundi 3 juin 2019

laravel not setting session, set_cookie is missing from response header

after form submit for 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 3 types of users and implemented multi auth for them. The form dont even post to the Controller. 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);
    }



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

Aucun commentaire:

Enregistrer un commentaire