Reputation: 264
I am trying to create a reset password URI, and it is there and uses the Laravel built in reset password system, but when I test it, I get:
FatalErrorException in EloquentUserProvider.php line 126: Class '\App\User' not found
This is my config/auth.php:
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
'model' => App\User::class,
And this is is my app/Http/routes.php:
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::post('register', 'RegisterController@register');
Route::post('resetpassword', 'Auth\PasswordController@postEmail');
Route::resource('api/authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('api/authenticate', 'AuthenticateController@authenticate');
//All protected routes should go in this group
Route::group(['middleware' => 'isUserAuthed'], function () {
Route::get('restricted', 'WelcomeController@welcome');
});
My User class is located at app/User.php:
<?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Model implements AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
use Authenticatable, Authorizable, CanResetPassword;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name', 'username', 'password', 'role', 'active', 'email'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
}
Can someone point me in the right direction? The documentation for this doesn't seem very clear to me.
Upvotes: 0
Views: 3646
Reputation: 66
\App\User should be able to be found by EloquentUserProvider
Have you tried running this command in your applications folder?
composer dump-autoload
Upvotes: 0