topclaudy / compoships

Multi-columns relationships for Laravel's Eloquent ORM
MIT License
1.12k stars 132 forks source link

Integration with Eloquent Eager Limit #173

Open lannodev opened 8 months ago

lannodev commented 8 months ago

Before Laravel 11 to use compoships with Eloquent Eager Limit it was necessary to use this Compoships Eager Limit package. Now the Eloquent Eager Limit package is native on Laravel. Please, its possible to make compoships to works with it ?

Using just compoships in laravel 11 I get the following error: stripos(): Argument #1 ($haystack) must be of type string, array given

example:

User::with([
    'posts' => fn ($query) => $query->limit(3)
])->paginate();

All the best

parallels999 commented 4 months ago

Feel free to open a PR with the upgrade, don't forget to add some tests

parkourben99 commented 2 weeks ago

@lannodev did you get this working? I'm also running into this issues updating a project to laravel 11.

lannodev commented 2 weeks ago

Hi @parkourben99 My project is still in version 10. I don't know how to implement this feature =/

parkourben99 commented 2 weeks ago

I'll give it a go next week. Will let you know how I go.

parkourben99 commented 1 week ago

I'll give it a go next week. Will let you know how I go.

I've created a PR https://github.com/topclaudy/compoships/pull/180 testing it on my project at the moment. I suspect it'll need to be extended to support other database types, not just MySql. Give it a go, see if it works for you.