Support the ongoing development of →
Eloquent IOC
Last updated 2 years ago.

Just put in your config/app.php alias

'User' = > 'App\Models\User', 'OtherModel = > 'App\Models\Namespace\OtherModel',


Its Manual process where i will have to add alias for each model. is their any shortcut way to add all the model globally


and all the model should be included same as in laravel 4.2

so i dont need to add namespace in every controller

Last updated 9 years ago.

I have the same issue. Still no answer? The above

andregeges said:

Just put in your config/app.php alias

'User' = > 'App\Models\User', 'OtherModel = > 'App\Models\Namespace\OtherModel',

doesn't work for me.


@mmguide2003, aliases are imported into the global namespace, so, if you are using aliases in a namespaced class, like a controller, or any other class that has namespace App\Something\OrOther; at the top, you should add use ShortAlias; to your file, or use \ShortAlias notation to specify that you mean ShortAlias from the global namespace, not App\Something\OrOther\ShortAlias.


Sign in to participate in this thread!


Your banner here too?

mukeshp004 mukeshp004 Joined 23 Jun 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.