staudenmeir / eloquent-has-many-deep

Laravel Eloquent HasManyThrough relationships with unlimited levels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Composite Keys only in PHP 8?

KingBier opened this issue · comments

Hey there,
thanks for the great enhancement for deep relationships. Pretty strong!
Just a question:
I have added it to my project with

composer require staudenmeir/eloquent-has-many-deep:"^1.7"

but there is no "Eloquent" folder in it and thus I cannot use CompositeKeys functionality.
My PHP version is PHP 7.4
Is it not available for that or can it be made available for that version as well?

I have the following relationships:
Review -> BelongsTo -> Recipe -> hasMany -> Conditions

tables:
reviews, recipes_reviews, recipes_conditions, conditions

I believe that with hasManyDeep and CompositeKeys its possible to get all Conditions from the User of the single Review.

If there are any other methods please let me know.

Thanks in advance

Hi @KingBier,
Composite keys are only available for Laravel 9 at the moment. What version are you using?

What composite keys would you need to define in this case?

thanks for your answer. maybe u can add the version requirement in the Readme.
I use Laravel 8.

Ok, I found a solution without using composite keys but i had to restructure my db tables and queries.
Now i can get the results i want.