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 theArchived
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...