Filament Laravel

Create a resource using Filament in Laravel Application

  1. To create resource, create DB migration file by using this command

php artisan make:model <ResourceName> -m
  1. Edit DB migration file (database/migration/ResourceName.php)

$table->string('name');
$table->json('attachments');
$table->string('email');
$table->text('description');
$table->longText('long_description');
$table->integer('number');
$table->uuid('product_id');
$table->increments('id');
$table->decimal('amount', 10, 2);
$table->date('created_at');
$table->time('sunrise', 0);
$table->dateTime('created_at', 0);
$table->foreignId('user_id');
->nullable();
->autoIncrement();
->unique();
->index();
  1. Edit Model file (Model/ResourceName.php)

  1. Run the database migration

  1. Create a filament resource menu

  1. Create a form for the resource by edit Resources file (app/Filament/Resource)

  1. To redirect back to table after user submit form, paste this code inside class (app\Filament\Resources\NameResource\Pages\CreateResource.php and EditResource.php)

  1. To create table resource, Edit Resources file (app/Filament/Resources)

Last updated