Text Version of the Lesson
Let's create a menu item and a table/form to manage products.

Generate Filament Resource
Every menu item in Filament is called a Resource, a visual representation of the Eloquent Model. Imagine we have this simple Model with two fields:
app/Models/Product.php:
class Product extends Model{ use HasFactory; protected $fillable = ['name', 'price'];}
Then we generate a Filament Resource for this model:
php artisan make:filament-resource Product
It generates a folder app/Filament/Resources/ProductResource with these...
About:
If you remove the edit and create from public static function getPages(): then it will open a modal, so you won't need the redirect.
Yes, I'm also planning to later talk about Simple resources where no redirect needed.
yes that's works
Late to the party but that was a brilliant revelation!
one thing I noticed is if you have a custom code on mutateFormDataBeforeCreate function. this wont execute this function if you remove edit and create on getpages() function.
amazing tip! :)
Good looking contant so far, will probably sign up.
One nice option to the artisan command to make a Resource worth mentioning is this:
Yes I showed that in the other lesson a bit later. Great option, indeed!
Hi. Is it possible to use Filament table builder using external data like json data. Thanks
Yup, the Filament site has a nice article on that topic: https://filamentphp.com/community/how-to-consume-an-external-api-with-filament-tables
Thanks
Here's an updated link for the article https://filamentphp.com/content/leandrocfe-how-to-consume-an-external-api-with-filament-tables
I have a problem with a resource: i created the form for the creating/editing of a row, but I need to make also a "bulk creting action": I have to insert in the creation form a start date and a end date, and then for each date in the range I have to create a new row with the other fields value. My problem is: how to create a specific form for this "bulk creation"?
I wouldn't call the thing you described as a "bulk action", in Filament terms the "bulk action" means that you select multiple records with checkboxes and then delete (or do something else) in bulk.
In your case, it's a custom action, which I would probably do as a Custom Page which means it's a Livewire component, and then you would add a link to it in your resource.
Example of such custom page with a form is in this article.
Hello, do you know if I can in some way use the Filament TextInput in a custom blade component ? I would like to keep the same the same design everywhere in the panel. Thx !
Filament has a few of their own Blade components, maybe try to use those? Here's my video about it.
Hey, it is possible to add event listener update last login column(users table) in filament?
It is!
But you will have to create a custom login page to add the function (You can follow this guide: https://laraveldaily.com/post/filament-registration-form-extra-fields-choose-user-role - just change the register action to login everywhere, same logic!) - then once user is logged in - you can add the column update.
Or another option is to listen for the
Loginevent. This is probably the fastest way to handle this. Here's the event you might want to listen tovendor/laravel/framework/src/Illuminate/Auth/Events/Login.phpnamespace App\Listeners;
use Illuminate\Auth\Events\Login;
class UpdateLastLoginAt { /** * Create the event listener. */ public function __construct() { // }
} i have error: Undefined method 'save'.intelephense(1013) function Model::save(array|null $options = []): bool Save the model to the database.
Re-fetch the user based on the ID, rather than trying to save like this. It should work as you should have an ID accessible
thx, working
public function handle(Login $event) { $user = User::find($event->user->id);
i ahve prblem at edit select users thats the edit not appear which user have edit how can i fix it
problem when click New Produk button, fill forms push create, and got error : Target class [Spatie\LaravelIgnition\ContextProviders\ComponentRegistry] does not exist.
it solved, using composer remove --dev spatie/laravel-ignition
Hey, how I can prevent double click in filament?