<?php

namespace App\Filament\Resources\AdditionalFacilityResource\Pages;

use App\Filament\Resources\AdditionalFacilityResource;
use Filament\Resources\Pages\CreateRecord;

class CreateAdditionalFacility extends CreateRecord
{
    protected static string $resource = AdditionalFacilityResource::class;

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        if (isset($data['name']) && is_array($data['name'])) {
            $data['name'] = [
                'ar' => $data['name']['ar'] ?? '',
                'en' => $data['name']['en'] ?? '',
            ];
        }

        return $data;
    }
}





