type->schema()->getSchema(); $this->resetValidation(); foreach ($formSchema as $key => $schema) { /** @var SettingSchema $schema */ $schema = $schema->schema; if ($schema->depends == $prop) { $this->detail[$key] = ''; } } $this->validateOnly($prop); } public function updatedType(): void { $this->reset('detail'); $schema = $this->type?->schema()?->getSchema() ?? []; foreach ($schema as $key => $value) { $this->detail[$key] = ''; } $this->resetValidation(); } public function rules(): array { $rules = []; $detailSchema = $this->type ?->schema() ->getSchema() ?? []; foreach ($detailSchema as $key => $schema) { $rules = array_merge($rules, [ 'detail.'.$key => $schema->schema->rules, ]); } return $rules; } public function validationAttributes(): array { $attributes = []; $detailSchema = $this->type ?->schema() ->getSchema() ?? []; foreach ($detailSchema as $key => $schema) { $attributes = array_merge($attributes, [ 'detail.'.$key => $schema->schema->attributes['label'], ]); } return $attributes; } public function toDto(): IssueInvoiceDTO { return new IssueInvoiceDTO( name: $this->name, clientRefId: $this->client_id, detail: $this->type->dtoTransform($this->detail), type: $this->type, status: InvoiceStatus::PENDING, clientId: $this->client_id ); } }