lodata
lodata copied to clipboard
All models discovered if one of them included in boot function of AppServiceProvider
I found out that including only one model in the boot method it discovers all other models and their relations. That is a strange behaviour that should be checked.
public function boot(): void
{
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
// \Lodata::discover(\App\Models\Customer::class);
// \Lodata::discover(\App\Models\ProductType::class);
\Lodata::discover(\App\Models\Status::class); -->> I only want this discovered
dd(\Lodata::getResources()); -->> this prints out all models + relations
}
Hi @bimix, this will happen if you have a LodataRelationship between two models, Lodata will discover both models in order to create the relationship - is this the case here?
@27pchrisl I don't think that's the case. I tried discovering only a model that has no direct relation with the model I am querying and it returns a response. When I try to log all discovered relations it logs everything (even if only one of them is discovered): dd(\Lodata::getResources());