show data based on data in database

i want to show data based on data in database example: [ 0 => public 1 => private ]
9 Replies
Vp
Vp2y ago
Can you be more specific, in table or select? or where do you want to check this condition?
shissaaa
shissaaaOP2y ago
if have email verified at then just show verified else show not verified
Vp
Vp2y ago
In the resource you can check like below
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->whereNotNull('email_verified_at');
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->whereNotNull('email_verified_at');
}
Or you can provide filter which will show "email_verified" only, and provide options to show all
Dennis Koch
Dennis Koch2y ago
Have a look at Filters in the docs.
shissaaa
shissaaaOP2y ago
I mean it will show all data. but it will show based on data in database when null, will show not verified. when have datetime, will show verified can you help me
Dennis Koch
Dennis Koch2y ago
You can use a BooleanColumn and getStateUsing()
shissaaa
shissaaaOP2y ago
oh, thank you so much
Noxo
Noxo2y ago
TextColumn::make('email_verified_at')
->getStateUsing(fn ($record) => is_null($record->email_verified_at) ? 'Not verified' : 'Verified')
->badge(),
TextColumn::make('email_verified_at')
->getStateUsing(fn ($record) => is_null($record->email_verified_at) ? 'Not verified' : 'Verified')
->badge(),
shissaaa
shissaaaOP2y ago
thank you so much

Did you find this page helpful?