Courses

Creating CRM with Filament 3: Step-By-Step

SoftDeletes: Archive and Restore Customers

You're reading a FREE PREVIEW of a PREMIUM course.
Summary of this lesson:
- Adding "Archived" tab with soft deleted records
- Implementing restore functionality
- Customizing row actions for archived records
- Adding delete/restore buttons with proper visibility rules

Sometimes, your Customer might get deleted for various reasons, but you might need to recover them months later. In Laravel, it's about SoftDeletes, but in the Filament version, we will show it as an Archived tab with a Restore button:

In this lesson, we will do the following:

  • Add the Archived tab to the Customers table
  • Add Delete button to the table
  • Add the Restore button to the Archived tab
  • Disable row click on the Archived tab

Adding Delete Button

The first thing to do is add the missing Delete button to our form:

app/Filament/Resources/CustomerResource.php

// ...
 
public static function table(Table $table): Table
{
return $table
->columns([
// ...
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
 
// ...
])
->bulkActions([
// ...
]);
}
 
// ...

That's it. Now we have a delete button in our table:


Adding Archived Tab

Now that we can delete our customers, we must see them somewhere. Let's add...

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

You also get:

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