The second issue of a new weekly tradition: every Wednesday/Thursday, I will publish an article with all the news about Filament from the previous week.
This week actually feels less active because the initial hype about Filament 3 died down a bit. That's normal. The daily releases are mostly about fixes in the docs, and Twitter isn't buzzing only about Filament.
But still, a lot to cover!
Filament Tips From Me
Tip 1. Resource Properties Should Be Static
If you create a property in the Resource class to reuse it in methods, make it STATIC.
Both form()
and table()
methods are static, so if you use smth like $this->options
, it will throw an error.
Create a static property and then use it as self::$options
Tip 2. Toggleable Columns
In tables, you can make any column toggleable, hiding it from the table in the top right corner.
Just add the method toggleable()
to the chain.
Changing the method parameter to "true" makes it hidden by default.
Tip 3. TranslateLabel Method
If you work with multilingual projects and want to translate the labels, you don't have to use the __()
method everywhere.
There's a specific method, translateLabel(),
which tries to automatically "guess" the key if you don't specify it.
Tutorials/Tweets from the Community
- Code with Dary on YouTube: Introduction & Setup of FilamentPHP v3
- Enhancing Laravel Filament V3 Development with Vite and Livewire Hot Reload
- Use ->slideOver() to display slide over panel on the right side instead of a modal
- Delete attachments when deleting a record
- Prevent deleting a record when it has a child record
- copyable() method in the infolists package
- In Filament v3 you can easily make tabs filter for your table
- Run php artisan make:filament-page and this will guide you through the process
- Render HTML (eg. link) in a field label
Official Releases: 3.0.16 - 3.0.23
The majority of this week's changes were about fixes and docs improvements, but still some new features, too:
- Add optional route tenant prefix
- Use getPrettyVersion instead of getVersion in info widget
- Add autocomplete attribute to password field
- Support hidden label in fieldset
- Add tooltip to hint icon
You can check out all the versions on the official Releases page.
That's it for this second 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...