How to implement specified action/button in laravel filament forms

What I am trying to do: Im trying to add a calculation button for my recalculate

What I did: im trying to make a button for my form that have a recalculate function

My issue/the error: it keeps bugging saying that the button is doesnt exist or its filament method/class is undefined

use Filament\Forms\Components\Actions\Action;

  Action::make('recalculate_salary')
                    ->label('Recalculate NET Salary')
                    ->icon('heroicon-o-refresh')
                    ->action(function (array $data, callable $set) {
                        $employeeId = $data['employees_id'];
                        $basicSalary = $data['BASICSALARY'];
                        $benefitsTotal = 0;

                        // Recalculate salary
                        if ($employeeId) {
                            $benefitsTotal = EmployeeBenefit::where('employees_id', $employeeId)
                                ->where('STATUS', true)
                                ->sum('AMOUNT');
                        }

                        // Calculate new net salary
                        $netSalary = $basicSalary - $benefitsTotal;
                        $set('NETSALARY', $netSalary > 0 ? $netSalary : 0);
                    })
Solution
nvm it been solved i should have put it in tables in actions
Was this page helpful?