Files
famous-ly4-ev/app-modules/booking/src/Filament/Resources/Bookings/Actions/DeleteBookingTableAction.php
T

24 lines
745 B
PHP
Raw Normal View History

<?php
namespace Modules\Booking\Filament\Resources\Bookings\Actions;
use Filament\Actions\DeleteAction;
/**
* Soft-delete only (Booking uses SoftDeletes). `authorize('delete')` ties
* both the visible/hidden state AND the actual delete call itself to
* BookingPolicy::delete (manage_bookings + terminal status) — unlike
* visible()/disabled(), which are UI-only, authorize() is enforced when the
* action runs (Filament\Actions\Concerns\CanBeAuthorized). A booking that
* isn't cancelled/expired never shows this button at all, rather than a
* dead disabled one.
*/
class DeleteBookingTableAction
{
public static function make(): DeleteAction
{
return DeleteAction::make()
->authorize('delete');
}
}