Hello, All
I meet some problem about Laravel 5 auth.
I create project and want to use default auth for login, and my config/auth.php setting is
<?php
return [
'driver' => 'eloquent',
'model' => 'App\User',
'table' => 'users',
'password' => [
'email' => 'emails.password',
'table' => 'password_resets',
'expire' => 60,
],
];
Just as the default setting, and my model for users is also the default User.php in App/
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model {
//
}
The problem occurs when I login at default login page: {Domain}/auth/login
I enter correct email, password and then submit. The ERROR occurs:
ErrorException in EloquentUserProvider.php line 109: Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\User given, called in /Sites/project/vendor/laravel/framework/src/Illuminate/Auth/Guard.php on line 397 and defined
I google these keywords but can not find out what's wrong.
Can anyone help me?
Thanks.
Try changing your User.php to look like https://github.com/laravel/laravel/blob/master/app/User.php
Try this for you model class declaration:
class User extends Eloquent implements UserInterface, RemindableInterface
Hey, for what it's worth, I ran into the exact issue when updating to laravel 5.1 (still running into in fact...). The user model was verbatim with what was in the laravel github repo. Everything is basically the same except for what was in my composer.json file.
Every time I do a composer update, it brings this error up unless I run a composer dumpautoload after updating. Still don't know the root of the cause, but this got things moving again.
-- Update --
Figured it out! I had a friggin' Model that was declaring itself as 'user'
In particular:
use Laravel\Cashier\Billable;
use Illuminate\Database\Eloquent\Model;
use Laravel\Cashier\Contracts\Billable as BillableContract;
class User extends Model implements BillableContract
{
use Billable;
protected $dates = ['trial_ends_at', 'subscription_ends_at'];
}
In other news, I am an idiot.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community