© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
Vp

halt table toggle column

How can I halt (not updating DB) toggle column?
Tables\Columns\ToggleColumn::make('recommend')
    ->beforeStateUpdated(function () {
        $recommendCount = Model::where('recommend', true)->count();

        if ($recommendCount >= 15) {
            // @todo(notification)
            return false; // not working
        }
    }),
Tables\Columns\ToggleColumn::make('recommend')
    ->beforeStateUpdated(function () {
        $recommendCount = Model::where('recommend', true)->count();

        if ($recommendCount >= 15) {
            // @todo(notification)
            return false; // not working
        }
    }),

In my case, if recommend count is gte = 15, I want to hold that event and shows notification and hold update process, but it still updating, how can I make it "not to update table"

Thanks in advance
Solution
I try like below and it's not updating anymore, so I think this validation error halt the process
if ($recommendCount >= 15) {
    Notification::make()
        ->title('Error')
        ->warning()
        ->send();

    throw ValidationException::withMessages([]);
}
if ($recommendCount >= 15) {
    Notification::make()
        ->title('Error')
        ->warning()
        ->send();

    throw ValidationException::withMessages([]);
}
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Halt reload table
FilamentFFilament / ❓┊help
13mo ago
Toggle-column
FilamentFFilament / ❓┊help
2y ago
Advanced toggle column to a table
FilamentFFilament / ❓┊help
2y ago
Toggle column issue.
FilamentFFilament / ❓┊help
3y ago