vendredi 12 octobre 2018

How to overwrite alias from package

I want to use the package https://github.com/mcamara/laravel-localization but I need to change a function inside the class LaravelLocalization

Inside the package I found a file called LaravelLocalizationServiceProvider that creates the alias

$this->app->alias(LaravelLocalization::class, 'laravellocalization');

I want to change it to something like this:

$this->app->alias(CustomizedLaravelLocalization::class, 'laravellocalization');

How can I do this?

This is what I though of:

Since I do not want to touch the files in the vendor folder I could extend the class LaravelLocalizationServiceProvider, and bind add it to \config\app providers array. However, I don't know when and how the class from LaravelLocalizationServiceProvider is called and how I can prevent it from being called.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire