Laravel 5 - Change model file location
Add the folder to the composer.json
classmap:
"autoload": {
"classmap": [
"database",
"app/Models"
]
}
you just need to namespace the models accordingly.
namespace App\Models\User
and wherever you may need to use them just reference them with the correct namespace.
use App\Models\User
Only Two places to change ...
1) At namespace in User.php
namespace App\Models;
When Use it,
use App\Models\User;
2) In config/auth.php
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
Note: After changing 2) ... Don't forget to php artisan config:cache
and php artisan config:clear
at command line.