Skip to content

Previous and next record ​

Two buttons before the header actions open the previous or the next record on the same page: from a customer's invoices to the next customer's invoices. A record that cannot open that page opens on its first page in the menu. They are off by default, since they add a few queries per render:

php
'record_navigation' => true,

They follow the list the user came from: its sort, filters, search and tab, as on screen (up to 100 records). From the first or the last record of that list there is nothing further, rather than a jump to another order. A record that is not in the list (opened from a link) walks by key. To always walk by key:

php
'record_navigation_follows_list' => false,

The list remembers its records only when record navigation is on in the config or on the resource (hasRelationNavigatorRecordNavigation()), since the list page cannot ask a record page.

They walk through the resource's own query (getRecordRouteBindingEloquentQuery()), so tenancy and your scopes apply, and skip the records the user cannot view. Per page:

php
public function hasRelationNavigatorRecordNavigation(): bool
{
    return true;
}

public function getRelationNavigatorRecordNavigationQuery(): ?Builder
{
    return Customer::query()->where('active', true);
}

Nested resources are not supported yet: they show no buttons.

Released under the MIT License.