Avoid ID in edit page
I need to use the edit page of my plugin without the ID
is it possible?
thanks
16 Replies
How would you know which record to edit?
I’d use a custom page for this purpose
Ok but how would you pass the id of record you want to edit?
Use a slug instead of ID? https://filamentphp.com/docs/3.x/panels/pages#customizing-the-page-url
I don't need to pass an ID.
I've built a custom settings management system as part of a larger plugin. It features a single form that saves each setting as a separate row in a database table. In the end, this results in around 30 rows.
When editing, I want to update all the rows simultaneously.
I know I can create a custom page in Filament, but since I'm developing a plugin, I haven’t found detailed information on how to build a custom page within the plugin rather than using the default list/create/edit pages.
is it possible to use custom pages i plugin?
Just use a standard page and not an edit page.
Even with that, there must be something that connects those 30 rows right? How would you know which 30 to edit. Anyway, There's no magic here, the pages are just routes - you can pass w/e you want to the page - but I don't think Filament will work out-of-the-box for you.
Maybe look into things like Sushi https://github.com/calebporzio/sushi (a tutorial of sorts on how to use it https://laraveldaily.com/post/filament-load-table-data-from-3rd-party-api)
Even with that, there must be something that connects those 30 rows right?
nope, they are just settings that i want to use in the frontend (i'm developing a custom frontend solution for filament)
In that case - a repeater could probably do what you want. If settings is a table, make it a relation to something like User, as in User::hasMany('settings'). Then the user/edit page can list every setting, available to edit, and save all with one submit.
i understand but this is a collection of settings related to the website's frontend, like logo, site name, description, seo...
i've tried to used a pair of filament's settings plugin but i need multi language settings and they doesn't support translations
So just use a custom Filament Page?
Yes, I know how to do this, but I would like to create a plugin so that when it's installed, it creates the table, etc. Is there a way to create a page within the plugin or to make the plugin itself create the page for me?
Tha towuld be custom page method no?
Then create the relationship like Models\Frontend::hasMany('settings'). Sure the relationship may be unnecessary, but the benefit is the Filament repeater can work with it easily.
it works!
- made a settings page in the plugin with form and the other methods
- added this to the form
registered the page