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 with a relationship to exist?

For example, I have this column that is working:

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


Which I'm trying to add to the filter:

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)


which I add the relationship method, but it wants a titleAttribute attribute. Unfortunately, the titleAttribute is using the value from the boolean which would be
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.
Was this page helpful?