- How do I add record navigation to a Filament resource with minimal setup?
- Install the package via Composer, then add `PreviousRecordAction` and `NextRecordAction` to your `getHeaderActions()` method in your `ViewRecord` or `EditRecord` page class. No traits or additional code are required for basic functionality.
- Does this package support Filament 5.x and Laravel 13?
- Yes, the package is fully compatible with Filament 4.x/5.x and Laravel 10–13. It leverages Filament’s stable APIs to ensure long-term compatibility without version-locking risks.
- Can I customize the navigation logic for filtered or tenant-scoped records?
- Absolutely. Use the `WithRecordNavigation` trait to override methods like `getPreviousRecord()` or `getNextRecord()`. This allows you to inject custom query logic, such as filtering by user roles, tenant IDs, or record status.
- What happens if my `order_column` (e.g., `created_at`) isn’t indexed? Will performance suffer?
- Navigation will still work, but performance may degrade on large datasets. For optimal results, ensure your `order_column` (default: `id`) is indexed. The package uses a single-query-per-render design to minimize overhead.
- How do I navigate to custom pages beyond `view` or `edit` (e.g., audit logs)?
- Use `NavigationPage::custom('page.key')` in your action configuration. This aligns with Filament’s `getPages()` convention, allowing navigation to any custom route defined in your resource.
- Will the navigation buttons auto-disable at the first/last record?
- Yes, the package automatically disables and grays out the navigation buttons when you reach the first or last record, ensuring a seamless user experience without additional configuration.
- Can I change the default ordering (e.g., from `id` to `created_at` descending)?
- Publish the config file with `php artisan vendor:publish --tag=filament-record-nav-config` to customize the `order_column` and `sort_direction` globally for all resources.
- Is this package suitable for read-only Filament resources?
- No, this package is designed for resources where records can be viewed or edited. Navigation implies the ability to traverse between records, so it’s best suited for CRUD workflows like content management or inventory systems.
- How do I test edge cases like single-record tables or concurrent edits?
- Test boundary conditions by creating a resource with one record and verify navigation buttons disable correctly. For concurrent edits, simulate race conditions by manually triggering record updates while navigating to ensure data consistency.
- Are there alternatives to this package for Filament navigation?
- If you need lightweight navigation, consider manually implementing `Previous`/`Next` actions with custom queries. For advanced use cases like multi-level navigation, explore Filament’s built-in pagination or third-party table packages with built-in navigation.