<?php

namespace App\Http\Requests\Nas;

class UpdateNasResourceRequest extends StoreNasResourceRequest
{
    public function rules(): array
    {
        return collect(parent::rules())
            ->map(function ($rules) {
                $rules = is_array($rules) ? $rules : [$rules];
                if (($index = array_search('required', $rules, true)) !== false) {
                    $rules[$index] = 'sometimes';
                }

                return $rules;
            })
            ->all();
    }
}
