Action::make('reject')
->color('danger')
->label('Reject')
->hidden(!auth()->user()->can('status_expense'))
->requiresConfirmation()
->action(function (array $data): void {
$this->record->status = Status::where('name', 'Rejected')->first()->id;
$this->record->save();
Notification::make()
->danger()
->title('Form Updated')
->body('The expense was rejected.')
->send();
$this->refreshFormData([
'status',
]);
$this->getResource()::getUrl('index');
// $this->redirect('index');
//fn () => $this->getResource()::getUrl('index');
// $this->getRedirectUrl();
})
Action::make('reject')
->color('danger')
->label('Reject')
->hidden(!auth()->user()->can('status_expense'))
->requiresConfirmation()
->action(function (array $data): void {
$this->record->status = Status::where('name', 'Rejected')->first()->id;
$this->record->save();
Notification::make()
->danger()
->title('Form Updated')
->body('The expense was rejected.')
->send();
$this->refreshFormData([
'status',
]);
$this->getResource()::getUrl('index');
// $this->redirect('index');
//fn () => $this->getResource()::getUrl('index');
// $this->getRedirectUrl();
})