I am currently working on a module system in Laravel 5. Currently in Laravel 5, you need to do it like this in the config/app.php
'aliases' => [
...other classes...
'App' => Illuminate\Support\Facades\App::class,
]
What I would like to do is, somewhere inside the main model of my module, set that or other models as an alias. So I don't need to change my config file every time I install or uninstall a module.
Anyone got a solution? Been trying this for a few days now, and I can't find a solution yet! Thanks in advance :)
There is the class_alias
PHP function that Laravel uses as well. You can just do this:
class_alias(The\Real\Class::class, 'TheAlias');