<?php

namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\Pages\AuditedCreateRecord;
use App\Filament\Resources\UserResource;
use Illuminate\Support\Facades\Hash;

class CreateUser extends AuditedCreateRecord
{
    protected static string $resource = UserResource::class;

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        if (isset($data['password'])) {
            $data['password'] = Hash::make($data['password']);
        }

        return $data;
    }
}
