create(); $case = ClientCase::factory()->create(['client_id' => $client->id]); // Create 5 contracts tied to the case with deterministic references foreach (range(1, 5) as $i) { Contract::factory()->create([ 'client_case_id' => $case->id, 'reference' => 'REF-'.$i, ]); } // Request page 2 with page size 2 using custom param names $response = $this->get(route('client.contracts', ['client' => $client->uuid, 'contracts_page' => 2, 'contracts_per_page' => 2])); $response->assertStatus(200); // Extract props $props = $response->inertia()->toArray()['props']; expect($props['contracts']['per_page'])->toBe(2) ->and($props['contracts']['current_page'])->toBe(2) ->and($props['contracts']['data'])->toHaveCount(2); // Ensure links use the custom page parameter name $anyLinkWithCustomParam = collect($props['contracts']['links'])->contains(function ($link) { return str_contains($link['url'] ?? '', 'contracts_page='); }); expect($anyLinkWithCustomParam)->toBeTrue(); });