0

Laravel filament and resource have the same model and data is in two different tables as is_admin = 0 and is_admin = 1 and I need to list, how can I do this in the same user table with the filament.

I used custom page but I couldn't make tables and listings with it.

2 Answers2

0

You could override the getEloquentQuery method inside of your resource. For instance:

public static function getEloquentQuery(): Builder
{
    return parent::getEloquentQuery()->where('is_admin', 0);
}

This is a query builder interface, so you could join data to your query aswell.

0

This piece of code

  public static function getEloquentQuery(): Builder
   {
    return parent::getEloquentQuery()->where('is_admin', 0);
   }

was what I had been looking for