Level 2
if ($page == 1){
return redirect()->to(url()->current()); // url()->current() returns base URL without query
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Currently I am fetching and paginating the data and it is all seamless, works great, but I need to set a certain condition, one of such condition is when the user is on 1st page or when he has paginated back to the first page, I need to clear the parameter at that point i.e. from http://127.0.0.1:8000/users?page=1 to http://127.0.0.1:8000/users.
Something like Caleb has been using in withPagination trait, in Livewire.
public $page = 1;
public function getQueryString()
{
return array_merge(['page' => ['except' => 1]], $this->queryString);
}
How that can be attained with my current approach? Please throw some light on here. Thanks already!
Please or to participate in this conversation.