<?php

namespace App\Filament\Resources\StudentLifeEventsResource\Pages;

use App\Filament\Resources\StudentLifeEventsResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Gate;
class EditStudentLifeEvent extends EditRecord
{
    protected static string $resource = StudentLifeEventsResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\DeleteAction::make()
                ->visible(fn () => Gate::allows('delete studentlifeevent')),
        ];
    }

    protected function getRedirectUrl(): string
    {
        return $this->getResource()::getUrl('index');
    }

    protected function getSavedNotification(): ?Notification
    {
        return Notification::make()
            ->success()
            ->title('Student Life Event updated successfully')
            ->body('The student life event has been updated successfully.');
    }

    protected function mutateFormDataBeforeSave(array $data): array
    {
        return $data;
    }
}