- What is marko298/nova-single-record-resource used for?
- It is a Laravel Nova package for resources that should only ever contain one record. It adds a navigation link straight to that record and skips the index listing so users land on the edit form. It also hides Nova's create and delete actions to keep singleton screens clean.
- How do I install marko298/nova-single-record-resource?
- Install it with Composer using the package name marko298/nova-single-record-resource. Then follow the package README for registering the resource behavior in your Nova application. Because Laravel and Nova version constraints matter, check the Composer requirements before installing.
- Which Laravel and Nova versions are supported?
- This package is built for Laravel Nova, so your application must already use Nova. The exact Laravel and Nova version constraints are defined in the package's composer.json and README. Check those constraints before adding it to an existing project.
- How do I configure a resource as single-record?
- You configure the single-record behavior in your Nova resource class, while defining fields as you normally would for Nova. The package then handles the navigation link and hides index, create, and delete flows. Refer to the README for the exact class, trait, or method names to use.
- What happens to Nova's create and delete actions?
- The package hides Nova's create and delete actions for the resource. That prevents users from adding duplicate records or removing the singleton accidentally. You should still create or seed the single record so the edit form has something to load.
- Can I use it for settings pages?
- Yes, settings and configuration pages are the main use case. Any Nova resource that should have exactly one row, such as global options or site settings, can use the singleton approach. It keeps users on the edit form instead of an index list.
- Is it safe to use in production?
- It is intended for Nova admin screens, so test it in staging with your exact Laravel and Nova versions before production. Make sure the singleton record exists and that policies still restrict who can view or update it. Since create and delete are hidden, plan how the initial record will be seeded.
- How do I test a single-record resource?
- Test it like other Nova resources by asserting the navigation link resolves to the edit form and that create and delete actions are absent. Seed one record in your test database so the edit screen can load. Also cover authorization with your Nova policies.
- What alternatives should I consider?
- You can use a standard Nova resource with policies that block create and delete, plus custom navigation to the edit page. A custom Nova tool or page is another option for fully bespoke settings screens. This package is a simpler choice when you just need singleton resource behavior.
- How is the package maintained?
- Maintenance should be checked on the package's GitHub repository and Packagist page. Review recent commits, releases, and open issues for compatibility with your Nova version. Pin a version in Composer and retest after Laravel or Nova upgrades.