Custom Filament Table with Query of Left Joined Tables

I have managed to create livewire component with filament table in it as described here:

https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component

In the example, the query for the table is given for a single model. (Product::query())

How can I pass the query for the filament table so that it will take 2 joined tables?

SELECT * FROM employees LEFT JOIN attendances ON employees.id = attendances.employee_id
Solution
Thanks, Dennis. I think I am getting somewhere. I tried as follow:
public function table(Table $table): Table
{
        return $table
            ->query(Employee::query()->leftJoin('attendances','employees.id','=','attendances.employee_id'))
            ->columns([
                TextColumn::make('first_name'), // column exists in Employee table and is showing
                TextColumn::make('result'), // column exists in Attendances table but is NOT showing
            ])...
}

It seems to run correctly but the "result" column which supposes to get the data from the "attendances" table is not showing. Did I miss anything? Thanks!
Was this page helpful?