ollieread / multiauth

Laravel multi auth
441 stars 109 forks source link

Illuminate\Auth\EloquentUserProvider::validateCredentials() erorr! #45

Closed thanoseleftherakos closed 10 years ago

thanoseleftherakos commented 10 years ago

Hello, im trying to use multiauth for users table and admin table but im getting this error:

Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Auth\UserInterface, instance of Admin given, called in C:\xampp\htdocs\userapi\vendor\laravel\framework\src\Illuminate\Auth\Guard.php on line 370 and defined

here is my model Admin.php

<?php

class Admin extends Eloquent  {

    protected $guarded = array();
    protected $table = 'admin';
    protected $fillable = array('email','username','password','password_temp','active');
    protected $hidden = array('password', 'remember_token');

    public static $rulesLogin = array(
        'username' => 'required|min:3',
        'password' => 'required|min:6'
    );

    public static $messagesLogin = array(
        'username.required' => 'username is required',
        'password.required' => 'password is required'
    );

}

thank you

ollieread commented 10 years ago

Your Admin class doesn't implement the right class, it's tricky because the Laravel documentation doesn't mention this at all, take a look at the default User.php model.