Overview
Resources arenāt the only way to interact with Eloquent records in a Filament panel. Even though resources may solve many of your requirements, the āindexā (root) page of a resource contains a table with a list of records in that resource.
Sometimes there is no need for a table that lists records in a resource. There is only a single record that the user interacts with. If it doesnāt yet exist when the user visits the page, it gets created when the form is first submitted by the user to save it. If the record already exists, it is loaded into the form when the page is first loaded, and updated when the form is submitted.
For example, a CMS might have a Page Eloquent model and a PageResource, but you may also want to create a singular page outside the PageResource for editing the āhomepageā of the website. This allows the user to directly edit the homepage without having to navigate to the PageResource and find the homepage record in the table.
Other examples of this include a āSettingsā page, or a āProfileā page for the currently logged-in user. For these use cases, though, we recommend that you use the Spatie Settings plugin and the Profile features of Filament, which require less code to implement.
Creating a singular resource
Use a custom page with a form to manage a single record without a resource table.
Firstly, create a custom page:
This creates a page class and a Blade view in your panelās configured page directories.
The example below loads the homepage or uses form defaults if it does not exist.
Custom pages do not automatically apply resource policies. Authorize access to the page and the create or update operation, and apply any tenant or ownership restrictions your application requires to the query.
The page Blade view should render the form: