Home >> Laravel framework 5.0 >>
Where to put model in laravel 5
This article will explain you, where to put model in laravel 5.
By default laravel provide one model and named is user.php which is inside app directory, If you want to move it in particular directory you are free to do it but for that you need to follow some conventions.
Now let's create one folder inside app directory named it Models and move user.php model in to Models directory but give proper namespace like
Note: user.php used for auth in laravel so you need to chnage user.php model location in config/auth.php
'model' => 'App\Models\User',
Now load model from composer.json autoload
Once model auto load has been configured in composer.json that means now every time models will get automatically loaded from Models directory. You can create n number's of models in Models directory and all will auto loaded automatically.