douhensheng1131
2018-03-28 12:16
浏览 342
已采纳

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

The error is

InvalidArgumentException …\vendor\laravel\framework\src\Illuminate\Auth\CreatesUserProviders.php42

config/auth.php

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

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

This is my Admin model

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';


}

I've googled this error. But there aren't any solutions at all

update: Here's my provider array

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

],

图片转代码服务由CSDN问答提供 功能建议

错误是

InvalidArgumentException ... \ vendor \ laravel \ framework \ src \ Illuminate \ Auth \ CreatesUserProviders.php42

config / auth.php

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

这是我的管理员模型

 使用Illuminate  \ Notifications \ Notifiable; 
use Illuminate \ Foundation \ Auth \ User as Authenticatable; 
 
class Admin extends Authenticatable 
 {
 use Notifiable; 
 
 protected $ guard ='admin'; 
 / ** \  n *可批量分配的属性。
 * 
 * @var array 
 * / 
 protected $ fillable = [
'name','email','password',
]; 
 \  n / ** 
 *应该为数组隐藏的属性。
 * 
 * @var array 
 * / 
 protected $ hidden = [
'password','remember_token',
];  
 
 protected $ table ='admins'; 
 
 
} 
   
 
 

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

更新: 这是我的提供者数组 <前> '提供者 '=&gt; [ '用户'=&gt; [ 'driver'=&gt; 'eloquent', 'model'=&gt; App \ User :: class, ], 'admins'=&gt; [ 'drivers'=&gt; 'eloquent', 'model'=&gt; App \ Admin :: class, ], ],

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dtnqbre7980007 2018-03-29 20:56
    已采纳

    Seems like you have typo on your config/auth.php

    'provider' => 'admins'
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题