Action that changes value in Form
When the action Accept is pressed, the dropdown in the form should change to "Yes"
class EditExpense extends EditRecord
{
protected static string $resource = ExpenseResource::class;
protected function getActions(): array
{
return [
Actions\DeleteAction::make(),
Action::make('accept')
->color('success')
->label('Accept')
->disabled(!auth()->user()->can('status_expense'))
->requiresConfirmation()
// ->action(function (Status $record, array $data): void {
// $record->author()->where('name', 'Yes')->first()->id;
// $record->save();
// })
// ->mountUsing(fn (Forms\ComponentContainer $form, User $record) => $form->fill([
// 'status' => Status::where('name', 'Yes')->first()->id,
// ]))
,
// Action::make('reject')
// ->color('danger')
// ->label('Reject')
// ->action('rejectAction')
// ->disabled(!auth()->user()->can('status_expense')),
];
}
}class EditExpense extends EditRecord
{
protected static string $resource = ExpenseResource::class;
protected function getActions(): array
{
return [
Actions\DeleteAction::make(),
Action::make('accept')
->color('success')
->label('Accept')
->disabled(!auth()->user()->can('status_expense'))
->requiresConfirmation()
// ->action(function (Status $record, array $data): void {
// $record->author()->where('name', 'Yes')->first()->id;
// $record->save();
// })
// ->mountUsing(fn (Forms\ComponentContainer $form, User $record) => $form->fill([
// 'status' => Status::where('name', 'Yes')->first()->id,
// ]))
,
// Action::make('reject')
// ->color('danger')
// ->label('Reject')
// ->action('rejectAction')
// ->disabled(!auth()->user()->can('status_expense')),
];
}
}