i am doing multi authentication my front end has a login form with cardno and password. in auth.php
return [
'multi' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
'table' => 'users'
],
'frontendUsers' => [
'driver' => 'eloquent',
'model' => App\loginModel::class,
'table' => 'frontend_users'
]
],
'password' => [
'email' => 'emails.password',
'table' => 'password_resets',
'expire' => 60,
],
];
in route.php
Route::post('login','auth\loginController@postLogin');
in logincontroller,
public function postLogin(Request $request){
....
// attempt to do the login
if (\Auth::attempt('frontendUsers', ['cardno' => '111111', 'password' => '999087787'])) {
echo "login";
}
else {
echo "failed";
}
}
in loginModel.php
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
class loginModel extends Model {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'frontend_users';
//public $timestamps = false;
}
when i try to log in i get this error
ErrorException in EloquentUserProvider.php line 110: Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\loginModel given, called in C:\xampp\htdocs\elitecard\vendor\laravel\framework\src\Illuminate\Auth\Guard.php on line 390 and defined