->queryStringIdentifier() not working in custom data

When I click Next or Previous, the query string does not update in the URL here's my custom data
->records(function(?string $search, int $page, string | int $recordsPerPage) use($data,$type): LengthAwarePaginator {

$records = collect($data->with('latestCalledTicket')
->get()
->when($type == 'regular', fn($query) => $query->whereNull('priority_type'))
->when($type == 'priority', fn($query) => $query->whereNotNull('priority_type'))
->toArray())
->transform(function($item) {

$item['sort'] = !$item['latest_called_ticket'] ? 0 : (fluent($item['latest_called_ticket'])?->skipped ?? 0);

return $item;
})
->sortBy('sort')
->when(
filled($search),
fn (Collection $data): Collection => $data->filter(
fn (array $record): bool => str_contains(
Str::lower($record['ticket_no']),
Str::lower($search),
),
),
);
$recordsPerPage = $recordsPerPage == 'all' ? $records->count() : $recordsPerPage;

// $page = $type == 'priority' ? request('priority') : $page;

$paginator = new LengthAwarePaginator(
$records->forPage($page, $recordsPerPage),
total: $records->count(),
perPage: $recordsPerPage,
currentPage: $page,
);
return $paginator;
})
->records(function(?string $search, int $page, string | int $recordsPerPage) use($data,$type): LengthAwarePaginator {

$records = collect($data->with('latestCalledTicket')
->get()
->when($type == 'regular', fn($query) => $query->whereNull('priority_type'))
->when($type == 'priority', fn($query) => $query->whereNotNull('priority_type'))
->toArray())
->transform(function($item) {

$item['sort'] = !$item['latest_called_ticket'] ? 0 : (fluent($item['latest_called_ticket'])?->skipped ?? 0);

return $item;
})
->sortBy('sort')
->when(
filled($search),
fn (Collection $data): Collection => $data->filter(
fn (array $record): bool => str_contains(
Str::lower($record['ticket_no']),
Str::lower($search),
),
),
);
$recordsPerPage = $recordsPerPage == 'all' ? $records->count() : $recordsPerPage;

// $page = $type == 'priority' ? request('priority') : $page;

$paginator = new LengthAwarePaginator(
$records->forPage($page, $recordsPerPage),
total: $records->count(),
perPage: $recordsPerPage,
currentPage: $page,
);
return $paginator;
})
1 Reply
rexma404
rexma404OP2w ago
This is my table 1
public function table(Table $table): Table
{
return (new RequestsTable())
->configure($table, type: 'priority')
->pushColumns([
TextColumn::make('priority_type')
->formatStateUsing(fn($state) => strtoupper($state))
])
->queryStringIdentifier('priority')
;
}
public function table(Table $table): Table
{
return (new RequestsTable())
->configure($table, type: 'priority')
->pushColumns([
TextColumn::make('priority_type')
->formatStateUsing(fn($state) => strtoupper($state))
])
->queryStringIdentifier('priority')
;
}
When I click next, there's nothing happen

Did you find this page helpful?