docs icon indicating copy to clipboard operation
docs copied to clipboard

[12.x] only use and document the `limit` and `offset` methods

Open browner12 opened this issue 6 months ago • 3 comments

skip() and take() are alias methods to offset() and limit(). IMO we should only use and document the main methods, not the aliases. This will encourage more performant coding, just like we now do in laravel/framework.

IF it's decided we still want to mention the aliases, I'd recommended listing them second as the alternatives. I can make that change if desired.

follow up to https://github.com/laravel/framework/pull/56080 and https://github.com/laravel/framework/pull/56081

browner12 avatar Jun 20 '25 15:06 browner12

Well, what do we have aliases for if we make sure nobody knows about them?

shaedrich avatar Jun 20 '25 17:06 shaedrich

agreed, we should get rid of the aliases. but we can't because of BC.

browner12 avatar Jun 20 '25 17:06 browner12

we should get rid of the aliases

Well, that is your opinion.

And I'm sure, Taylor has something to say about that, too.

shaedrich avatar Jun 20 '25 17:06 shaedrich

Proposal

Remove skip() and take() in Laravel 13 to reduce ambiguity and enforce consistency with SQL terminology. As aliases for offset() and limit(), they introduce unnecessary abstraction.

I appreciate that skip() and take() have served as convenient aliases for many developers, especially those newer to SQL. However, after gaining a deeper understanding of the underlying SQL concepts, I believe these methods can be misleading.

Since Laravel 13 will allow for breaking changes, this might be an appropriate opportunity to consider removing skip() and take() from the core.

AhmedAlaa4611 avatar Jun 21 '25 08:06 AhmedAlaa4611

I appreciate that skip() and take() have served as convenient aliases for many developers, especially those newer to SQL.

If you are looking for a lean framework, Laravel might not be what you are looking for. Laravel is and always has been a framework that offered multiple ways of doing something.

shaedrich avatar Jun 21 '25 10:06 shaedrich