The Filament Record Navigation Plugin allows seamless navigation through records in a Filament resource's view. With this plugin, you can add "Next" and "Previous" buttons to navigate through records efficiently.
Record.Nav.mp4
composer require josespinal/filament-record-navigationThe package will automatically register itself.
In your Filament resource's EditRecord page, use the HasRecordNavigation trait to add the navigation functionality. And add the action where you want, for example, the header with getHeaderActions:
namespace App\Filament\Resources\PostResource\Pages;
use App\Filament\Resources\PostResource;
use Filament\Resources\Pages\EditRecord;
use JoseEspinal\RecordNavigation\Traits\HasRecordNavigation;
class EditPost extends EditRecord
{
use HasRecordNavigation;
protected static string $resource = PostResource::class;
protected function getHeaderActions(): array
{
return array_merge(parent::getActions(), $this->getNavigationActions());
}
}If you have existing actions, merge them with the navigation actions, like so:
protected function getHeaderActions(): array
{
$existingActions = [
// Your existing actions here...
];
return array_merge($existingActions, $this->getNavigationActions());
}In your resource's ListRecords page, include the HasRecordsList trait as follows:
namespace App\Filament\Resources\PostResource\Pages;
use App\Filament\Resources\PostResource;
use Filament\Resources\Pages\ListRecords;
use JoseEspinal\RecordNavigation\Traits\HasRecordsList;
class ListPosts extends ListRecords
{
use HasRecordsList;
protected static string $resource = PostResource::class;
}Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.