Laravel多用户Auth登录

在Laravel中实现多用户登录时,遇到 Argument 1 passed to IlluminateAuthEloquentUserProvider::validateCredentials() 的错误。解决方法包括修改/config/auth.php配置,并通过php artisan make:model创建新的用户模型。完成这些步骤后,使用Auth::guard('add')即可进行新角色的验证。

使用多用户登录可能遇到Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentia...的错误,那么,如何实现多用户登录呢?

首先,进入/config/auth.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Defaults
    |--------------------------------------------------------------------------
    |
    | This option controls the default authentication "guard" and password
    | reset options for your application. You may change these defaults
    | as required, but they're a perfect start for most applications.
    |
    */

    'defaults' => [
        'guard' => 'web', //默认的Auth方式
        'passwords' => 'users',
    ],

    /*
    |--------------------------------------------------------------------------
    | Authentication Guards
    |--------------------------------------------------------------------------
    |
    | Next, you may define every authentication gua
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值