I have database radius
with table radcheck
without migration. I want table radcheck
as table authentication,not users.i try change config/auth
from 'user' to radcheck
. but an error
Table radcheck
:
id,
username,
attribute,
op,
value=> as password,
barcode
Code in 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');
}
}
and then, I change config/auth from users to radcheck in Config/auth
:
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Model\Management\Radcheck::class,
],
Error looks like this:
Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\Model\Management\Radcheck given, called in C:\xampp\htdocs\e-access\system\vendor\laravel\framework\src\Illuminate\Auth\SessionGuard.php on line 385 and defined
EloquentUserProvider
accept only the instance of Illuminate\Foundation\Auth\User
so you need to extends your RadCheck by Illuminate\Foundation\Auth\User
Just change your RadCheck
by following code
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');
}
}