Powered by Mintlify
Auto-generate your docs
use Filament\Tables\Columns\CheckboxColumn;
CheckboxColumn::make('is_admin')
CheckboxColumn::make('is_featured')
CheckboxColumn::make('is_published')
CheckboxColumn::make('is_active')
CheckboxColumn::make('is_admin')
->rules(['required', 'boolean'])
CheckboxColumn::make('is_active')
->beforeStateUpdated(function ($record, $state) {
// Runs before the state is saved to the database
// You can perform checks or prepare data here
})
->afterStateUpdated(function ($record, $state) {
// Runs after the state is saved to the database
// You can trigger notifications, update related records, etc.
})
CheckboxColumn::make('is_published')
->afterStateUpdated(function ($record, $state) {
if ($state) {
// Send notification when published
Notification::make()
->title('Post published')
->success()
->send();
}
})
CheckboxColumn::make('is_admin')
->disabled(fn ($record) => $record->is_super_admin)
CheckboxColumn::make('is_featured')
->tooltip('Mark this post as featured')