我有数据库hotfixes
,表radius
没有迁移。我希望表radcheck
作为表格身份验证,而不是用户。我尝试从用户'更改radcheck
到config/auth
。但是错误
表radcheck
:
radcheck
id,
username,
attribute,
op,
value=> as password,
barcode
中的代码:
radcheck.php
然后,我在namespace App\Model\Management;
use Illuminate\Database\Eloquent\Model;
class Radcheck extends Model
{
protected $table = 'radcheck';
protected $primarykey = 'id';
protected $fillable = ['id','username','attribute','op','value','barcode'];
public $timestamps = false;
public function radusergroups(){
return $this->hasMany('App\Model\Management\Radusergroup');
}
}
中将config / auth从用户更改为radcheck:
Config/auth
错误如下所示:
传递给Illuminate \ Auth \ EloquentUserProvider :: validateCredentials()的参数1必须是Illuminate \ Contracts \ Auth \ Authenticatable的实例,App \ Model \ Management \ Radcheck的实例,在C:\ xampp \ htdocs \中调用第385行的e-access \ system \ vendor \ laravel \ framework \ src \ Illuminate \ Auth \ SessionGuard.php并定义
答案 0 :(得分:1)
The model should extend Authenticable
:
use Illuminate\Foundation\Auth\User as Authenticable;
class Radcheck extends Authenticable
答案 1 :(得分:1)
EloquentUserProvider
仅接受Illuminate\Foundation\Auth\User
的实例,因此您需要按Illuminate\Foundation\Auth\User
只需按照以下代码更改RadCheck
radcheck.php
namespace App\Model\Management;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Radcheck extends Authenticatable
{
use Notifiable;
protected $table = 'radcheck';
protected $primarykey = 'id';
protected $fillable = ['id','username','attribute','op','value','barcode'];
public $timestamps = false;
public function radusergroups(){
return $this->hasMany('App\Model\Management\Radusergroup');
}
}