Toggle Column Prevent Action

Hello, I have an issue cannot seem to figure out where to place my check on record if it has all requried fields - only than it can be activated. I tried beforeStateUpdated but it throws warning but still proceeds to update that record? Any idea how to prevent it?
Tables\Columns\ToggleColumn::make('active')
->disabled(function (Project $record) {
return !$record->hasAllRequiredFields();
})
->afterStateUpdated(function(){
Cache::forget(CacheManager::makeCacheToken("active_projects"));

Notification::make()
->success()
->title(__("Project Status Updated"))
->send();
}),
Tables\Columns\ToggleColumn::make('active')
->disabled(function (Project $record) {
return !$record->hasAllRequiredFields();
})
->afterStateUpdated(function(){
Cache::forget(CacheManager::makeCacheToken("active_projects"));

Notification::make()
->success()
->title(__("Project Status Updated"))
->send();
}),
1 Reply
toeknee
toeknee4d ago
Can you try updating to the latest release? I did just see there was a disable action fix

Did you find this page helpful?