© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
11 replies
jwktje

Hide a resource widget based on the resource status

Hey everyone. I found the option to hide a widget on a resource with this function:

public static function canView(): bool

The issue is that I want to only show the widget if the resource record/model is in a certain status. But I can't access the record because the function is static. Does anyone know a workaround?

What I would like to do but doesn't work:

class Availability extends Widget
{
    public ?Model $record = null;

    public static function canView(): bool
    {
        return $this->record->status === StatusEnum::Request;
    }
}
class Availability extends Widget
{
    public ?Model $record = null;

    public static function canView(): bool
    {
        return $this->record->status === StatusEnum::Request;
    }
}


Something that feels hacky that works:

$record = Event::find(Route::current()->parameter('record'));
return $record->status === StatusEnum::Request;
$record = Event::find(Route::current()->parameter('record'));
return $record->status === StatusEnum::Request;
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

Hide SelectColumn based on soft delete status
FilamentFFilament / ❓┊help
3y ago
How to Authenticate User based on their Status, and also hide few Resource Pages based on the Role
FilamentFFilament / ❓┊help
3y ago
Hide widget on dashboard
FilamentFFilament / ❓┊help
3y ago
Hide the Delete button on Resource
FilamentFFilament / ❓┊help
3y ago