layer-chicken/app/Filament/Resources/Finance/Payrolls/Actions/DeleteAdjustmentAction.php

32 lines
823 B
PHP

<?php
namespace App\Filament\Resources\Finance\Payrolls\Actions;
use App\Filament\Support\SystemNotification;
use App\Models\PayrollAdjustment;
use Filament\Actions\Action;
class DeleteAdjustmentAction extends Action
{
public static function getDefaultName(): ?string
{
return 'deleteAdjustment';
}
protected function setUp(): void
{
parent::setUp();
$this->label('Hapus')
->icon('heroicon-m-trash')
->iconButton()
->color('danger')
->requiresConfirmation()
->action(function (array $arguments) {
$adjustment = PayrollAdjustment::findOrFail($arguments['adjustment_id']);
$adjustment->delete();
})
->successNotification(SystemNotification::delete());
}
}