update deploy

This commit is contained in:
bulut
2026-03-27 10:41:54 +03:00
parent 69d19c0176
commit 6f6448aa06
422 changed files with 37956 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?php
namespace App\DTOs;
class AnnouncementData
{
public function __construct(
public readonly string $slug,
public readonly string $title,
public readonly string $category,
public readonly string $excerpt,
public readonly string $content,
public readonly ?string $image = null,
public readonly bool $isFeatured = false,
public readonly ?string $metaTitle = null,
public readonly ?string $metaDescription = null,
public readonly ?string $publishedAt = null,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
slug: $data['slug'],
title: $data['title'],
category: $data['category'],
excerpt: $data['excerpt'],
content: $data['content'],
image: $data['image'] ?? null,
isFeatured: $data['is_featured'] ?? false,
metaTitle: $data['meta_title'] ?? null,
metaDescription: $data['meta_description'] ?? null,
publishedAt: $data['published_at'] ?? null,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'slug' => $this->slug,
'title' => $this->title,
'category' => $this->category,
'excerpt' => $this->excerpt,
'content' => $this->content,
'image' => $this->image,
'is_featured' => $this->isFeatured,
'meta_title' => $this->metaTitle,
'meta_description' => $this->metaDescription,
'published_at' => $this->publishedAt,
];
}
}

45
app/DTOs/CategoryData.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
namespace App\DTOs;
class CategoryData
{
public function __construct(
public readonly string $slug,
public readonly string $label,
public readonly ?string $desc = null,
public readonly ?string $image = null,
public readonly ?string $metaTitle = null,
public readonly ?string $metaDescription = null,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
slug: $data['slug'],
label: $data['label'],
desc: $data['desc'] ?? null,
image: $data['image'] ?? null,
metaTitle: $data['meta_title'] ?? null,
metaDescription: $data['meta_description'] ?? null,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'slug' => $this->slug,
'label' => $this->label,
'desc' => $this->desc,
'image' => $this->image,
'meta_title' => $this->metaTitle,
'meta_description' => $this->metaDescription,
];
}
}

48
app/DTOs/CommentData.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
namespace App\DTOs;
final readonly class CommentData
{
public function __construct(
public string $commentableType,
public int $commentableId,
public string $authorName,
public string $content,
public ?int $rating,
public bool $isApproved = false,
public ?string $adminReply = null,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
commentableType: $data['commentable_type'],
commentableId: $data['commentable_id'],
content: $data['content'],
authorName: $data['author_name'],
rating: $data['rating'] ?? null,
isApproved: $data['is_approved'] ?? false,
adminReply: $data['admin_reply'] ?? null,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'commentable_type' => $this->commentableType,
'commentable_id' => $this->commentableId,
'author_name' => $this->authorName,
'content' => $this->content,
'rating' => $this->rating,
'is_approved' => $this->isApproved,
'admin_reply' => $this->adminReply,
];
}
}

92
app/DTOs/CourseData.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
namespace App\DTOs;
class CourseData
{
/**
* @param list<string>|null $includes
* @param list<string>|null $requirements
* @param list<string>|null $scope
*/
public function __construct(
public readonly int $categoryId,
public readonly string $slug,
public readonly string $title,
public readonly string $desc,
public readonly string $longDesc,
public readonly string $duration,
public readonly ?string $sub = null,
public readonly int $students = 0,
public readonly float $rating = 5.0,
public readonly ?string $badge = null,
public readonly ?string $image = null,
public readonly ?string $price = null,
public readonly ?array $includes = null,
public readonly ?array $requirements = null,
public readonly ?string $metaTitle = null,
public readonly ?string $metaDescription = null,
public readonly ?array $scope = null,
public readonly ?string $standard = null,
public readonly ?string $language = null,
public readonly ?string $location = null,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
categoryId: $data['category_id'],
slug: $data['slug'],
title: $data['title'],
desc: $data['desc'],
longDesc: $data['long_desc'],
duration: $data['duration'],
sub: $data['sub'] ?? null,
students: $data['students'] ?? 0,
rating: $data['rating'] ?? 5.0,
badge: $data['badge'] ?? null,
image: $data['image'] ?? null,
price: $data['price'] ?? null,
includes: $data['includes'] ?? null,
requirements: $data['requirements'] ?? null,
metaTitle: $data['meta_title'] ?? null,
metaDescription: $data['meta_description'] ?? null,
scope: $data['scope'] ?? null,
standard: $data['standard'] ?? null,
language: $data['language'] ?? null,
location: $data['location'] ?? null,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'category_id' => $this->categoryId,
'slug' => $this->slug,
'title' => $this->title,
'sub' => $this->sub,
'desc' => $this->desc,
'long_desc' => $this->longDesc,
'duration' => $this->duration,
'students' => $this->students,
'rating' => $this->rating,
'badge' => $this->badge,
'image' => $this->image,
'price' => $this->price,
'includes' => $this->includes,
'requirements' => $this->requirements,
'meta_title' => $this->metaTitle,
'meta_description' => $this->metaDescription,
'scope' => $this->scope,
'standard' => $this->standard,
'language' => $this->language,
'location' => $this->location,
];
}
}

44
app/DTOs/FaqData.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
namespace App\DTOs;
use App\Enums\FaqCategory;
final readonly class FaqData
{
public function __construct(
public string $question,
public string $answer,
public FaqCategory $category,
public int $orderIndex = 0,
public bool $isActive = true,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
question: $data['question'],
answer: $data['answer'],
category: FaqCategory::from($data['category']),
orderIndex: $data['order_index'] ?? 0,
isActive: $data['is_active'] ?? true,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'question' => $this->question,
'answer' => $this->answer,
'category' => $this->category->value,
'order_index' => $this->orderIndex,
'is_active' => $this->isActive,
];
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\DTOs;
final readonly class GuideCardData
{
public function __construct(
public string $title,
public string $description,
public ?string $icon,
public int $orderIndex = 0,
public bool $isActive = true,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
title: $data['title'],
description: $data['description'],
icon: $data['icon'] ?? null,
orderIndex: $data['order_index'] ?? 0,
isActive: $data['is_active'] ?? true,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'title' => $this->title,
'description' => $this->description,
'icon' => $this->icon,
'order_index' => $this->orderIndex,
'is_active' => $this->isActive,
];
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace App\DTOs;
final readonly class HeroSlideData
{
public function __construct(
public string $title,
public ?string $label = null,
public ?string $description = null,
public string $mediaType = 'image',
public ?string $image = null,
public ?string $videoUrl = null,
public ?string $mobileVideoUrl = null,
public ?string $mobileImage = null,
public ?string $buttonText = null,
public ?string $buttonUrl = null,
public int $orderIndex = 0,
public bool $isActive = true,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
title: $data['title'],
label: $data['label'] ?? null,
description: $data['description'] ?? null,
mediaType: $data['media_type'] ?? 'image',
image: $data['image'] ?? null,
videoUrl: $data['video_url'] ?? null,
mobileVideoUrl: $data['mobile_video_url'] ?? null,
mobileImage: $data['mobile_image'] ?? null,
buttonText: $data['button_text'] ?? null,
buttonUrl: $data['button_url'] ?? null,
orderIndex: $data['order_index'] ?? 0,
isActive: $data['is_active'] ?? true,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'label' => $this->label,
'title' => $this->title,
'description' => $this->description,
'media_type' => $this->mediaType,
'image' => $this->image,
'video_url' => $this->videoUrl,
'mobile_video_url' => $this->mobileVideoUrl,
'mobile_image' => $this->mobileImage,
'button_text' => $this->buttonText,
'button_url' => $this->buttonUrl,
'order_index' => $this->orderIndex,
'is_active' => $this->isActive,
];
}
}

69
app/DTOs/LeadData.php Normal file
View File

@@ -0,0 +1,69 @@
<?php
namespace App\DTOs;
class LeadData
{
public function __construct(
public readonly string $name,
public readonly string $phone,
public readonly string $source,
public readonly ?string $email = null,
public readonly ?string $targetCourse = null,
public readonly ?string $educationLevel = null,
public readonly ?string $subject = null,
public readonly ?string $message = null,
public readonly ?array $utm = null,
public readonly bool $consentKvkk = false,
public readonly bool $marketingConsent = false,
public readonly ?string $consentTextVersion = null,
) {}
/**
* @param array<string, mixed> $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<string, mixed>
*/
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,
];
}
}

51
app/DTOs/MenuData.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
namespace App\DTOs;
use App\Enums\MenuLocation;
use App\Enums\MenuType;
final readonly class MenuData
{
public function __construct(
public string $label,
public string $url,
public MenuLocation $location,
public MenuType $type,
public ?int $parentId,
public int $orderIndex = 0,
public bool $isActive = true,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
label: $data['label'],
url: $data['url'],
location: MenuLocation::from($data['location']),
type: MenuType::from($data['type']),
parentId: $data['parent_id'] ?? null,
orderIndex: $data['order_index'] ?? 0,
isActive: $data['is_active'] ?? true,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'label' => $this->label,
'url' => $this->url,
'location' => $this->location->value,
'type' => $this->type->value,
'parent_id' => $this->parentId,
'order_index' => $this->orderIndex,
'is_active' => $this->isActive,
];
}
}

45
app/DTOs/PageData.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
namespace App\DTOs;
final readonly class PageData
{
public function __construct(
public string $slug,
public string $title,
public ?string $content,
public ?string $metaTitle,
public ?string $metaDescription,
public bool $isActive = true,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
slug: $data['slug'],
title: $data['title'],
content: $data['content'] ?? null,
metaTitle: $data['meta_title'] ?? null,
metaDescription: $data['meta_description'] ?? null,
isActive: $data['is_active'] ?? true,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'slug' => $this->slug,
'title' => $this->title,
'content' => $this->content,
'meta_title' => $this->metaTitle,
'meta_description' => $this->metaDescription,
'is_active' => $this->isActive,
];
}
}

48
app/DTOs/ScheduleData.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
namespace App\DTOs;
class ScheduleData
{
public function __construct(
public readonly int $courseId,
public readonly string $startDate,
public readonly string $endDate,
public readonly string $location,
public readonly int $quota,
public readonly int $availableSeats,
public readonly bool $isUrgent = false,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
courseId: $data['course_id'],
startDate: $data['start_date'],
endDate: $data['end_date'],
location: $data['location'],
quota: $data['quota'],
availableSeats: $data['available_seats'],
isUrgent: $data['is_urgent'] ?? false,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'course_id' => $this->courseId,
'start_date' => $this->startDate,
'end_date' => $this->endDate,
'location' => $this->location,
'quota' => $this->quota,
'available_seats' => $this->availableSeats,
'is_urgent' => $this->isUrgent,
];
}
}

43
app/DTOs/UserData.php Normal file
View File

@@ -0,0 +1,43 @@
<?php
namespace App\DTOs;
class UserData
{
public function __construct(
public readonly string $name,
public readonly string $email,
public readonly ?string $password = null,
public readonly ?string $role = null,
) {}
/**
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
name: $data['name'],
email: $data['email'],
password: $data['password'] ?? null,
role: $data['role'] ?? null,
);
}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
$result = [
'name' => $this->name,
'email' => $this->email,
];
if ($this->password !== null) {
$result['password'] = $this->password;
}
return $result;
}
}