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
Vp16mo ago
Can you be more specific, in table or select? or where do you want to check this condition?
shissaaa
shissaaaOP16mo ago
if have email verified at then just show verified else show not verified
Vp
Vp16mo 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 Koch16mo ago
Have a look at Filters in the docs.
shissaaa
shissaaaOP16mo 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 Koch16mo ago
You can use a BooleanColumn and getStateUsing()
shissaaa
shissaaaOP16mo ago
oh, thank you so much
Noxo
Noxo16mo 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
shissaaaOP16mo ago
thank you so much
Want results from more Discord servers?
Add your server