Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All models discovered if one of them included in boot function of AppServiceProvider #847

Open
bimix opened this issue Dec 5, 2024 · 2 comments

Comments

@bimix
Copy link

bimix commented Dec 5, 2024

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

}
@27pchrisl
Copy link
Contributor

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?

@bimix
Copy link
Author

bimix commented Dec 5, 2024

@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());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants