blemli / formsettings-for-filament
rule your forms
Package info
github.com/blemli/formsettings-for-filament
pkg:composer/blemli/formsettings-for-filament
Fund package maintenance!
Requires
- php: ^8.2
- filament/filament: ^4.0|^5.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^3.7|^4.0
- pestphp/pest-plugin-arch: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
- pestphp/pest-plugin-livewire: ^3.0|^4.0
README
rule your forms
A gear on your form pages that lets every user tune the form like the table column selector: reorder the tab order, hide optional fields, pick an autofocus entry point, and choose what the submit button does (save / save & next / save & back, cmd+enter included). Forms that use tabs (or wizard steps) show their fields grouped by tab, and an entry point inside another tab activates that tab on load.
Installation
composer require blemli/formsettings-for-filament
php artisan formsettings-for-filament:install # publishes config + migration (only needed with persist())
Usage
use Blemli\FormSettings\FormSettingsPlugin; $panel->plugin( FormSettingsPlugin::make() ->persist() // … settings per user in the DB instead of the session ->presets() // … named presets ->publish([Profanity::make()]) // … users can share presets with ohters (requires persist) ->ignoreGroups(['English', 'Deutsch']) // … tabs that should NOT group the panel (e.g. translation tabs) ->saveAndBackButton() // to quickly edit things ->learn(after: 5) // … quiet suggestions inside the panel "you often start in xyz, set as entrypoint?" ->except([EditPost::class]) // never show the gear on these pages ->showOnMobile() // by default the gear hides on small screens ->perResource() // one settings record per resource instead of per page ->predefined([PostResource::class => ['Quick entry' => ['hidden' => ['tags']]]]) // ship presets with your app ->authorize('use-formsettings') // only show the settings to users which pass this gate ->optIn() // dont show the gear anywhere except on Pages with the HasFormSettings Trait );
With optIn(), single pages join via the trait:
use Blemli\FormSettings\Concerns\HasFormSettings; class EditPost extends EditRecord { use HasFormSettings; }
Lock single fields against hiding and reordering:
TextInput::make('iban')->formSettingsLocked()
Find fields nobody uses (requires persist() + learn()):
php artisan formsettings:graveyard
Uninstall
Uninstall cleanly with php artisan formsettings:uninstall.
License
MIT — see LICENSE.
