Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.1 Class '\App\User' not found, FatalErrorException in EloquentUserProvider.php line 126

I moved my User Model from App\User to App\Models\Users, I followed the proper instruction, the same thing working properly on Windows OS, while facing error on Ubuntu 14.04

Whenever I try to Login(When submit information) it gives me error

FatalErrorException in /var/www/html/sms/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php

line 126: Class '\App\User' not found

I also run composer dump-autoload command, but no luck. Also tried this

https://stackoverflow.com/a/28516582/1216451

Here is my settings for Models directory

composer.json

"autoload": {
    "classmap": [
        "database",
        "app/Models"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},

Model Directory Structure App/Models/

Model User.php

namespace App\Models;

Auth.php tried both lines, given below.

'model' => App\Models\User::class,
'model' => App\Models\User,

AuthController.php

use App\Models\User;

EloquentUserProvider.php path is sms/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php line 126

public function createModel()
{
    $class = '\\'.ltrim($this->model, '\\');

    return new $class; //line# 126
}
like image 441
Qazi Avatar asked Apr 06 '16 06:04

Qazi


1 Answers

Your configurations seems accurate, just reset them by using php artisan config:clear

like image 112
N.J Avatar answered Nov 05 '22 18:11

N.J