H
H
heleonprime2016-06-30 15:30:34
Laravel
heleonprime, 2016-06-30 15:30:34

How to force a service provider to use a custom class internally (laravel 5)?

There is a service provider, it has several classes. I am not satisfied with the logic in one of them and would like to change it. Is there a way to make it use my custom class instead? So that, for example, my class with the same namespace as the original class is loaded before the original class in the vendor folder? Or maybe there are some ready-made methods for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
heleonprime, 2016-06-30
@heleonprime

Solved the issue this way:
Added to composer.json

"psr-4": {
    "App\\": "app/",
    "Zofe\\Rapyd\\DataForm\\Field\\": "app/Field"
}

where "Zofe\\Rapyd\\DataForm\\Field\\" is the namespace of the class in Redactor.php
In the "app/Field" folder I threw the same Redactor.php file with the class that needs to be replaced
. Next, I performed "composer dump-auto",
That's it, now the class is first loaded from "app/Field"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question