© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
ahinkle

Table Filter, `BooleanConstraint` relationship exists

Hi friends,

I'm attempting to add a QueryBuilder filter with a simple bool of if they have any registered warranties or not.

Any ideas on how to get the
BooleanConstraint
BooleanConstraint
with a relationship to exist?

For example, I have this column that is working:

IconColumn::make('warranties_exists')
    ->label('Registered Warranty')
    ->exists('warranties')
...
IconColumn::make('warranties_exists')
    ->label('Registered Warranty')
    ->exists('warranties')
...


Which I'm trying to add to the filter:

BooleanConstraint::make('warranties_exists'),
BooleanConstraint::make('warranties_exists'),


which wants to apply to the current model:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.warranty_exists' in 'where clause'
SELECT count(*) AS aggregate FROM `users` WHERE (`users`.`warranties_exists` = 1)
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.warranty_exists' in 'where clause'
SELECT count(*) AS aggregate FROM `users` WHERE (`users`.`warranties_exists` = 1)


which I add the
relationship
relationship
method, but it wants a
titleAttribute
titleAttribute
attribute. Unfortunately, the
titleAttribute
titleAttribute
is using the value from the boolean which would be
1
1
.

BooleanConstraint::make('warranties_exists')
    ->relationship(
        name: 'warranties',
        titleAttribute: 'id',
    ),

// Any ideas how to get this to work? titleAttribute uses the value of the boolean.
BooleanConstraint::make('warranties_exists')
    ->relationship(
        name: 'warranties',
        titleAttribute: 'id',
    ),

// Any ideas how to get this to work? titleAttribute uses the value of the boolean.
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

Eager loaded relationship based on table filter
FilamentFFilament / ❓┊help
3y ago
Table filter with a relationship like so?
FilamentFFilament / ❓┊help
3y ago
Relationship Does Not Exists
FilamentFFilament / ❓┊help
3y ago