update deploy
This commit is contained in:
36
app/Http/Resources/AnnouncementResource.php
Normal file
36
app/Http/Resources/AnnouncementResource.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Announcement;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Announcement
|
||||
*/
|
||||
class AnnouncementResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'slug' => $this->slug,
|
||||
'title' => $this->title,
|
||||
'category' => $this->category?->value,
|
||||
'excerpt' => $this->excerpt,
|
||||
'content' => $this->content,
|
||||
'image' => $this->image,
|
||||
'is_featured' => $this->is_featured,
|
||||
'meta_title' => $this->meta_title,
|
||||
'meta_description' => $this->meta_description,
|
||||
'published_at' => $this->published_at?->toISOString(),
|
||||
'comments' => CommentResource::collection($this->whenLoaded('comments')),
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
38
app/Http/Resources/CategoryResource.php
Normal file
38
app/Http/Resources/CategoryResource.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Category;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Category
|
||||
*/
|
||||
class CategoryResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'slug' => $this->slug,
|
||||
'label' => $this->label,
|
||||
'desc' => $this->desc,
|
||||
'image' => $this->image,
|
||||
'meta_title' => $this->meta_title,
|
||||
'meta_description' => $this->meta_description,
|
||||
'courses_count' => $this->whenCounted('courses'),
|
||||
// Mega menu kartında gösterilecek kurslar (menu_order 1-3)
|
||||
'menu_courses' => $this->whenLoaded('menuCourses', fn () => $this->menuCourses->map(fn ($c) => [
|
||||
'title' => $c->title,
|
||||
'slug' => $c->slug,
|
||||
])
|
||||
),
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Http/Resources/CommentResource.php
Normal file
32
app/Http/Resources/CommentResource.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Comment;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Comment
|
||||
*/
|
||||
class CommentResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'commentable_type' => $this->commentable_type,
|
||||
'commentable_id' => $this->commentable_id,
|
||||
'author_name' => $this->author_name,
|
||||
'content' => $this->content,
|
||||
'rating' => $this->rating,
|
||||
'is_approved' => $this->is_approved,
|
||||
'admin_reply' => $this->admin_reply,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
26
app/Http/Resources/CourseBlockResource.php
Normal file
26
app/Http/Resources/CourseBlockResource.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\CourseBlock;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin CourseBlock
|
||||
*/
|
||||
class CourseBlockResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'content' => $this->content,
|
||||
'order_index' => $this->order_index,
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Http/Resources/CourseResource.php
Normal file
49
app/Http/Resources/CourseResource.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Course;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Course
|
||||
*/
|
||||
class CourseResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'category_id' => $this->category_id,
|
||||
'category' => new CategoryResource($this->whenLoaded('category')),
|
||||
'slug' => $this->slug,
|
||||
'title' => $this->title,
|
||||
'sub' => $this->sub,
|
||||
'desc' => $this->desc,
|
||||
'long_desc' => $this->long_desc,
|
||||
'duration' => $this->duration,
|
||||
'students' => $this->students,
|
||||
'rating' => $this->rating,
|
||||
'badge' => $this->badge?->value,
|
||||
'badge_label' => $this->badge?->label(),
|
||||
'image' => $this->image,
|
||||
'price' => $this->price,
|
||||
'includes' => $this->includes,
|
||||
'requirements' => $this->requirements,
|
||||
'meta_title' => $this->meta_title,
|
||||
'meta_description' => $this->meta_description,
|
||||
'scope' => $this->scope,
|
||||
'standard' => $this->standard,
|
||||
'language' => $this->language,
|
||||
'location' => $this->location,
|
||||
'blocks' => CourseBlockResource::collection($this->whenLoaded('blocks')),
|
||||
'schedules' => CourseScheduleResource::collection($this->whenLoaded('schedules')),
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
38
app/Http/Resources/CourseScheduleResource.php
Normal file
38
app/Http/Resources/CourseScheduleResource.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\CourseSchedule;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin CourseSchedule
|
||||
*/
|
||||
class CourseScheduleResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'course_id' => $this->course_id,
|
||||
'course' => new CourseResource($this->whenLoaded('course')),
|
||||
'start_date' => $this->start_date?->toDateString(),
|
||||
'end_date' => $this->end_date?->toDateString(),
|
||||
'location' => $this->location,
|
||||
'instructor' => $this->instructor,
|
||||
'quota' => $this->quota,
|
||||
'available_seats' => $this->available_seats,
|
||||
'enrolled_count' => $this->enrolled_count,
|
||||
'price_override' => $this->price_override,
|
||||
'status' => $this->status,
|
||||
'is_urgent' => $this->is_urgent,
|
||||
'notes' => $this->notes,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Http/Resources/FaqResource.php
Normal file
30
app/Http/Resources/FaqResource.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Faq;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Faq
|
||||
*/
|
||||
class FaqResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'question' => $this->question,
|
||||
'answer' => $this->answer,
|
||||
'category' => $this->category?->value,
|
||||
'order_index' => $this->order_index,
|
||||
'is_active' => $this->is_active,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Http/Resources/GuideCardResource.php
Normal file
30
app/Http/Resources/GuideCardResource.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\GuideCard;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin GuideCard
|
||||
*/
|
||||
class GuideCardResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'icon' => $this->icon,
|
||||
'order_index' => $this->order_index,
|
||||
'is_active' => $this->is_active,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
37
app/Http/Resources/HeroSlideResource.php
Normal file
37
app/Http/Resources/HeroSlideResource.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\HeroSlide;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin HeroSlide
|
||||
*/
|
||||
class HeroSlideResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'label' => $this->label,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'media_type' => $this->media_type ?? 'image',
|
||||
'image' => $this->image,
|
||||
'video_url' => $this->video_url,
|
||||
'mobile_video_url' => $this->mobile_video_url,
|
||||
'mobile_image' => $this->mobile_image,
|
||||
'button_text' => $this->button_text,
|
||||
'button_url' => $this->button_url,
|
||||
'order_index' => $this->order_index,
|
||||
'is_active' => $this->is_active,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
43
app/Http/Resources/LeadResource.php
Normal file
43
app/Http/Resources/LeadResource.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Lead;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Lead
|
||||
*/
|
||||
class LeadResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$utm = $this->utm;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'phone' => $this->phone,
|
||||
'email' => $this->email,
|
||||
'source' => $this->source?->value,
|
||||
'status' => $this->status?->value,
|
||||
'target_course' => $this->target_course,
|
||||
'education_level' => $this->education_level,
|
||||
'subject' => $this->subject,
|
||||
'message' => $this->message,
|
||||
'utm_source' => $utm['utm_source'] ?? null,
|
||||
'utm_medium' => $utm['utm_medium'] ?? null,
|
||||
'utm_campaign' => $utm['utm_campaign'] ?? null,
|
||||
'kvkk_consent' => $this->consent_kvkk,
|
||||
'marketing_consent' => $this->marketing_consent,
|
||||
'is_read' => $this->is_read,
|
||||
'admin_note' => $this->notes,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Http/Resources/MenuResource.php
Normal file
33
app/Http/Resources/MenuResource.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Menu;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Menu
|
||||
*/
|
||||
class MenuResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'label' => $this->label,
|
||||
'url' => $this->url,
|
||||
'location' => $this->location?->value,
|
||||
'type' => $this->type?->value,
|
||||
'parent_id' => $this->parent_id,
|
||||
'order_index' => $this->order_index,
|
||||
'is_active' => $this->is_active,
|
||||
'children' => self::collection($this->whenLoaded('children')),
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
26
app/Http/Resources/PageBlockResource.php
Normal file
26
app/Http/Resources/PageBlockResource.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\PageBlock;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin PageBlock
|
||||
*/
|
||||
class PageBlockResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'content' => $this->content,
|
||||
'order_index' => $this->order_index,
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Http/Resources/PageResource.php
Normal file
32
app/Http/Resources/PageResource.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Page;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Page
|
||||
*/
|
||||
class PageResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'slug' => $this->slug,
|
||||
'title' => $this->title,
|
||||
'content' => $this->content,
|
||||
'meta_title' => $this->meta_title,
|
||||
'meta_description' => $this->meta_description,
|
||||
'is_active' => $this->is_active,
|
||||
'blocks' => PageBlockResource::collection($this->whenLoaded('blocks')),
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
29
app/Http/Resources/RoleResource.php
Normal file
29
app/Http/Resources/RoleResource.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
/**
|
||||
* @mixin Role
|
||||
*/
|
||||
class RoleResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'guard_name' => $this->guard_name,
|
||||
'permissions' => $this->whenLoaded('permissions', fn () => $this->permissions->pluck('name')),
|
||||
'users_count' => $this->whenCounted('users'),
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
29
app/Http/Resources/SettingResource.php
Normal file
29
app/Http/Resources/SettingResource.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Setting
|
||||
*/
|
||||
class SettingResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'key' => $this->key,
|
||||
'value' => $this->value,
|
||||
'group' => $this->group?->value,
|
||||
'type' => $this->type?->value,
|
||||
'label' => $this->label,
|
||||
'order_index' => $this->order_index,
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Http/Resources/StoryResource.php
Normal file
33
app/Http/Resources/StoryResource.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Story;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Story
|
||||
*/
|
||||
class StoryResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'badge' => $this->badge,
|
||||
'content' => $this->content,
|
||||
'image' => $this->image,
|
||||
'cta_text' => $this->cta_text,
|
||||
'cta_url' => $this->cta_url,
|
||||
'order_index' => $this->order_index,
|
||||
'is_active' => $this->is_active,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
31
app/Http/Resources/UserResource.php
Normal file
31
app/Http/Resources/UserResource.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin User
|
||||
*/
|
||||
class UserResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'roles' => $this->whenLoaded('roles', fn () => $this->getRoleNames()),
|
||||
'permissions' => $this->whenLoaded('roles', fn () => $this->getAllPermissions()->pluck('name')),
|
||||
'email_verified_at' => $this->email_verified_at?->toISOString(),
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
'deleted_at' => $this->deleted_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user