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

Support limits #180

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Support limits #180

wants to merge 6 commits into from

Conversation

parkourben99
Copy link

@parkourben99 parkourben99 commented Nov 17, 2024

Fixes #173

Support sub query limits. Now that the Eloquent Eager Limit package is native in Larave 11l.

example usage:

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

@parkourben99 parkourben99 marked this pull request as ready for review November 25, 2024 12:34
@topclaudy
Copy link
Owner

Hi @parkourben99 Thank you for the PR! This package is designed to support Laravel versions prior to 11. However, the Laravel version constraint in your composer.json file would restrict compatibility with those versions.

"illuminate/database": ">=5.6 <12.0"
"php": "^8.0",
"illuminate/database": "^11.0",
"laravel/serializable-closure": "^1.3|^2.0"
Copy link

@parallels999 parallels999 Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, the Laravel version constraint in your composer.json file would restrict compatibility with those versions.

Remove this line

-"php": "^8.0",
-"illuminate/database": "^11.0",
-"laravel/serializable-closure": "^1.3|^2.0"
+"illuminate/database": ">=5.6 <12.0"

Also merge it with master

@parkourben99
Copy link
Author

parkourben99 commented Jan 10, 2025

Hi @parkourben99 Thank you for the PR! This package is designed to support Laravel versions prior to 11. However, the Laravel version constraint in your composer.json file would restrict compatibility with those versions.

I'm not sure these changes will work with previous versions of laravel, due to the recent change in laravel to support limits.

Do the tests run on previous versions?

* @covers \Awobaz\Compoships\Database\Grammar\MySqlGrammar
*/
public function test_relation_limit()
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure these changes will work with previous versions of laravel

Add something like this

if (getLaravelVersion() < 11.0) {
    $this->markTestIncomplete('This test is broken on laravel 10.x and earlier!');
}

if (getLaravelVersion() < 8.0) {
$this->markTestIncomplete('This test is broken on laravel 7.x and earlier!');
}

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

Successfully merging this pull request may close these issues.

Integration with Eloquent Eager Limit
3 participants