我一直在尝试按照指令的指示来委托使用https://github.com/zizaco/entrust
我已经根据要求进行了所有更改,添加的用户和角色(我没有添加权限,因为我不需要检查它们...只是角色),为用户分配了角色,当我尝试记录时在用户中,我得到此错误消息
参数1传递给 Illuminate Auth EloquentuserProvider :: vartatecredentials()必须是一个 照明 Contracts Auth Authenticatable的实例,实例 app 用户给予,调用 c: www procurement2 vendor laravel framework src inluminate auth auth sessionguard.php 在第385行上定义
我不知道这个错误是什么含义或如何修复
这是所有代码更改
app/user.php
<?php
namespace App;
use ZizacoEntrustTraitsEntrustUserTrait;
use IlluminateDatabaseEloquentModel as Eloquent;
class User extends Eloquent
{
use EntrustUserTrait;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'firstname', 'lastname', 'email', 'password', 'userlevel', 'buyer'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
app/http/kernel.php
protected $routeMiddleware = [
'auth' => IlluminateAuthMiddlewareAuthenticate::class,
'auth.basic' => IlluminateAuthMiddlewareAuthenticateWithBasicAuth::class,
'bindings' => IlluminateRoutingMiddlewareSubstituteBindings::class,
'can' => IlluminateAuthMiddlewareAuthorize::class,
'guest' => AppHttpMiddlewareRedirectIfAuthenticated::class,
'throttle' => IlluminateRoutingMiddlewareThrottleRequests::class,
'role' => ZizacoEntrustMiddlewareEntrustRole::class,
'permission' => ZizacoEntrustMiddlewareEntrustPermission::class,
'ability' => ZizacoEntrustMiddlewareEntrustAbility::class,
];
app/config/app.php
'providers' => [
/*
* Laravel Framework Service Providers...
*/
...
/*
* Package Service Providers...
*/
ZizacoEntrustEntrustServiceProvider::class,
];
'aliases' => [
'App' => IlluminateSupportFacadesApp::class,
'Artisan' => IlluminateSupportFacadesArtisan::class,
'Auth' => IlluminateSupportFacadesAuth::class,
...
'Entrust' => ZizacoEntrustEntrustFacade::class,
],
app/config/auth.php
'users' => [
'driver' => 'eloquent',
'model' => AppUser::class,
'table' => 'users',
],
App/User.php
应该扩展IlluminateFoundationAuthUser
而不是use IlluminateDatabaseEloquentModel as Eloquent;
。