laravel 5.5多次验证错误'InvalidArgumentException未定义验证用户提供程序[]。

时间:2018-03-28 12:16:34

标签: php laravel

错误是

  

InvalidArgumentException   ... \厂商\ laravel \框架\ SRC \照亮\验证\ CreatesUserProviders.php42

config / auth.php

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

        'api' => [
            'driver' => 'token',
            'provider' => 'users',
        ],
        'admin' => [
            'driver' => 'session',
            'provider' => 'adminss',
        ],
    ],

这是我的管理员模型

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Admin extends Authenticatable
{
    use Notifiable;

    protected $guard = 'admin';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    protected $table = 'admins';


}

我用Google搜索了这个错误。但根本没有任何解决方案

更新 这是我的提供者数组

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\User::class,
    ],
    'admins' => [
            'drivers' => 'eloquent',
            'model' => App\Admin::class,
    ],

],

1 个答案:

答案 0 :(得分:1)

好像你的config/auth.php

上有拼写错误
'provider' => 'admins'