<?php

namespace App\Filament\Resources\StudentLifeResource\Pages;

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

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

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

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

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