如何在Laravel 5.3中将Auth :: guard('web')转换为Auth :: guard('user')?

时间:2017-01-19 20:47:44

标签: laravel laravel-5.3

我在Laravel 5.3中有2名后卫:webadmin

我需要在Laravel 5.3中将Auth::guard('web')转换为Auth::guard('user')吗?

如何将web转换为user

更改auth.php后:

'defaults' => [
    'guard' => 'user',
    'passwords' => 'users',
],

'guards' => [
    'user' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'admin' => [
        'driver' => 'session',
        'provider' => 'admin',
    ],

    'api' => [
        'driver' => 'token',
        'provider' => 'users',
    ],
],
'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\User::class,
    ],

    'admin' => [
        'driver' => 'eloquent',
        'model' => App\Admin::class,
    ],
],
'passwords' => [
    'users' => [
        'provider' => 'users',
        'table' => 'password_resets',
        'expire' => 60,
    ],
],

1 个答案:

答案 0 :(得分:2)

您应该打开Post -> Topic (taxonomy) - Arts - Ideas - Politics -> Theme (taxonomy) - Insights - Science - Philosophy

您应该在config/auth.phpweb数组中的user数组和guards数组上更新defaultsproviders,您将拥有passwords