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

Just put in your config/app.php alias

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

0

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

App\Models

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.
0

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.

0

@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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

mukeshp004 mukeshp004 Joined 23 Jun 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.