Use registerModel if it is already used by another package same contract model
I am using package: Bagisto Graphql.
When I extend my product model from my package I see that in blade $products it is extended from "ACME\HelloWorld\Models\Webkul\Product\Models\Product" not from my model "ACME\HelloWorld\Models\Product
If I remove the line form provider of Graphql package
This line... // Catalog Product Models $this->app->concord->registerModel(\Webkul\Product\Contracts\Product::class, \Webkul\GraphQLAPI\Models\Catalog\Product::class);
In this case I see my own model and not the Graphql model "ACME\HelloWorld\Models\Product
Here is the question but can I extend a model if it is already extended by another package?
Is a problem of the Graphql packet that doesn't go a proxy?
There is a question of the position order of the module to see who takes precedence in the registerModel?
I solved it! You extend the last extended model of a specific class. By using the registerModel you link your new one with the last extended one. You have to be careful with the order of the providers in app.php as concord registers the connection with the key value so if it is not in the correct order your model will not be shown.
Naresh-webkul last edited by
HI @ILDaviz ,
Excactly, you need to define your service provider after the default modul service provider to override the existing models.