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
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
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!
The Laravel portal for problem solving, knowledge sharing and community building.
The community