$data */ public static function fromArray(array $data): self { $utm = array_filter([ 'utm_source' => $data['utm_source'] ?? null, 'utm_medium' => $data['utm_medium'] ?? null, 'utm_campaign' => $data['utm_campaign'] ?? null, ]); return new self( name: $data['name'], phone: $data['phone'], source: $data['source'], email: $data['email'] ?? null, targetCourse: $data['target_course'] ?? null, educationLevel: $data['education_level'] ?? null, subject: $data['subject'] ?? null, message: $data['message'] ?? null, utm: $utm ?: null, consentKvkk: (bool) ($data['kvkk_consent'] ?? false), marketingConsent: (bool) ($data['marketing_consent'] ?? false), consentTextVersion: $data['consent_text_version'] ?? null, ); } /** * @return array */ public function toArray(): array { return [ 'name' => $this->name, 'phone' => $this->phone, 'email' => $this->email, 'source' => $this->source, 'target_course' => $this->targetCourse, 'education_level' => $this->educationLevel, 'subject' => $this->subject, 'message' => $this->message, 'utm' => $this->utm, 'consent_kvkk' => $this->consentKvkk, 'marketing_consent' => $this->marketingConsent, 'consent_text_version' => $this->consentTextVersion, ]; } }