Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GirlioSalama95's avatar

Laravel remove offset from the query

How can I remove the limit/offset from the below query?

$query = TestModel::where('a', 'b')->limit(100);

$query->removeLimit(); 

I'm using a query from another module and I don't want to change the code.

0 likes
4 replies
tisuchi's avatar
tisuchi
Best Answer
Level 70

@girliosalama95

Anyways, you can reset the $limit property:

$query = TestModel::where('a', 'b')->limit(100);
$query->limit = null;
$unlimited = $query->get();
6 likes

Please or to participate in this conversation.