I'm starting a new weekly tradition: every Wednesday/Thursday, I will publish an article with all the news about Filament from previous week.
My own tweets, tips and videos, version releases, tutorials and interesting things I encounter on forums.
There are just so many things happening with Filament after the v3 release that I'm just afraid it will be lost in the internet archive of quick tweets, so this weekly digest should solve that problem.
Enjoy this first issue!
Filament Tips From Me
Tip 1. Validation: Unique ignoreRecord
If you use validation with ->unique()
, don't forget to ignore the current record in the Edit form.
Otherwise, you will have a validation error "The [field] has already been taken." in the Edit form.
Yes, it's THAT easy in Filament, just a parameter!
Tip 2. helperText() with No Options
When building reactive forms with options based on other field values, you can use helperText()
with a callback function to show some text in case of no options.
In general, all Filament form methods support closures like this, so you can put custom logic.
Tip 3. Generate Resource and "Guess" Columns
You can generate Filament Resource with --generate
.
It will try to guess the fields from your DB schema!
php artisan make:filament-resource Category --generate
My example, with a Category model with "name" field. I didn't write/change a single line of code here.
Tutorials/Tweets from the Community
- Filament V3 - How to fill login automatically (local environment)
- How to Stop FilamentPHP Actions On Certain Conditions
- Did you know you can change some of your panel configuration for specific pages?
- Testing: we can directly pass the class of actions in case of testing features
- New Filament plugin that makes switching between panels an ease
Official Releases: 3.0.8 - 3.0.15
With so many minor/fix releases happening, I will highlight only some of the new features I found interesting over the last week or so.
- 3.0.10: Forms: add prefix and suffix to tags https://github.com/filamentphp/filament/pull/7461
- 3.0.9: Drops support for Laravel 9 https://github.com/filamentphp/filament/pull/7512
- 3.0.9: Panels: Multiple domains https://github.com/filamentphp/filament/pull/7398
- 3.0.9: Conditionally hiding menu items https://github.com/filamentphp/filament/pull/7477
- 3.0.8: Show missing or removed translation files https://github.com/filamentphp/filament/pull/7422
You can check out all the versions on the official Releases page.
That's it for this first issue of "This Week in Filament".
Let me know what you think, in the comments!
If you want more Filament examples, you can find more real-life projects on our FilamentExamples.com.
No comments or questions yet...