Courses

Filament 3 From Scratch: Practical Course

Table Columns for Live-Editing Data

You're reading a FREE PREVIEW of a PREMIUM course.
Summary of this lesson:
- Implementing toggle columns
- Adding checkbox columns
- Creating select columns
- Managing text input columns

Filament builds tables not only for showing data but also for live editing of some of the columns, and there are specific column types for it. We will look at them in this short lesson.


Toggle Column

Probably one of the most naturally looking fields for editing is the on/off toggle: from a UX perspective, admin panel users will immediately understand that it's clickable.

Let's add a field of whether a product is active and make it "toggleable".

Migration code:

Schema::table('products', function (Blueprint $table) {
$table->boolean('is_active')->default(true);
});

app/Models/Product.php:

class Product extends Model
{
protected $fillable = [
'name',
'price',
'status',
'category_id',
'is_active'
];

ProductResource.php:

return $table
->columns([
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('price'),
Tables\Columns\ToggleColumn::make('is_active'),

And that's it. You don't need to configure any more actions.

Data update works in live mode immediately when you click the column to change the value.


Checkbox Column

Very similar behavior to a ToggleColumn, just a different look.

Let's use the same is_active column but...

The full lesson is only for Premium Members.
Want to access all 24 lessons of this course? (101 min read)

You also get:

  • 76 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord