skip to Main Content

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

Answers


  1. 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.

    Login or Signup to reply.
  2. This piece of code

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

    was what I had been looking for

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search