📺Table

our framework has a class for table use to set filters for the table and add a row based actions

Filters

to add a new filter to the table you need to use some methods on the table() method to add

public function table(): Table
{
    return Table::make('table')->filters([
        Filter::make('customer_group_id')->rows([
            HasOne::make('customer_group_id')->relation('customersGroup')->validation("required|array")->label(__('Customer Group'))->model(\Modules\Customers\Entities\CustomersGroup::class),
        ])
    ]);
}

NOTE

The Filter class take only 1 row the name of this row must be the same name of the filter make method

that's for the frontend for the backend query on your Resource class use this method like

public function setFilters($query, Request $request): void {
    if($request->has('customer_group_id')){
        $query->where('customer_group_id', $request->get('customer_group_id'));
    }
}

Actions

to add a new action on the row you need to use ->actions() method on the Table::class method like

public function table(){
    return Table::make('table')->actions([
        Action::make('password')->type('main')->label(__('Password'))->icon('bx bx-lock')->modal('password'),
    ]);
}

Last updated