isMethod('POST'); return [ 'code' => [$isCreate ? 'required' : 'sometimes', 'string', 'max:50'], 'description' => [$isCreate ? 'required' : 'sometimes', 'string', 'max:255'], // chart_type é obrigatório só quando NÃO há pai; com pai, é herdado. 'chart_type' => [ $isCreate ? 'required_without:parent_id' : 'sometimes', 'nullable', 'string', 'max:50', ], 'parent_id' => ['nullable', 'integer', 'exists:financial_plan_accounts,id'], 'order' => ['nullable', 'string', 'max:50'], 'unit_id' => ['nullable', 'integer', 'exists:units,id'], ]; } }