Файловый менеджер - Редактировать - /home/clickysoft/public_html/charliapp-v2.clickysoft.net/app/Http/Resources/Admin/OutlineDetailResource.php
Назад
<?php namespace App\Http\Resources\Admin; use App\Models\Collaboration; use Illuminate\Http\Resources\Json\JsonResource; class OutlineDetailResource extends JsonResource { public function toArray($request) { // return parent::toArray($request); $attachments = []; $comments = []; $chapters = []; $collaborators = []; $collaborate = []; foreach ($this->chapters ?? [] as $chapter) { $chapterCards = []; foreach ($chapter->cards ?? [] as $card) { $tasks = []; foreach($card->tasks ?? [] as $task){ $collaborates =[]; // foreach($task->collaboration ?? [] as $collaborateItem){ // $collaborateItem = Collaboration::find($task->collabration_id); if(!empty($task->collaboration)){ $collaborates[] = [ 'id'=>$task->collaboration->id, 'user_id' => $task->collaboration->user_id, 'profile_image' => $task->collaboration->user->profile_image ?? null, 'profile_image_url' => $task->collaboration->user->profile_image_url ?? null, 'owner_id' => $task->collaboration->owner_id, 'collaboratable_type' => $task->collaboration->collaboratable_type, 'collaboratable_id' => $task->collaboration->collaboratable_id, 'role' => $task->collaboration->role, 'status' => $task->collaboration->status, 'email' => $task->collaboration->email, ]; $collaborate[] = [ 'id'=>$task->collaboration->id, 'user_id' => $task->collaboration->user_id, 'owner_id' => $task->collaboration->owner_id, 'collaboratable_type' => $task->collaboration->collaboratable_type, 'collaboratable_id' => $task->collaboration->collaboratable_id, 'role' => $task->collaboration->role, 'status' => $task->collaboration->status, 'email' => $task->collaboration->email, ]; } // } $tasks[] = [ 'id'=>$task->id, 'title'=>$task->title, 'due_date'=>$task->due_date, 'status'=>$task->status, 'task_type'=>$task->task_type, 'created_at'=>$task->created_at, 'type_id'=>$task->type_id, 'user_id'=>$task->user_id, 'collabrator_id'=>$task->collabrator_id, 'collabration_id'=>$task->collabration_id, 'file'=>$task->file, 'collaboration' =>$collaborates, ]; } $comments = []; foreach($card->comments as $comment){ $comments[] = [ 'id' => $comment->id, 'comment' => $comment->comment, 'comment_type'=> $comment->comment_type, 'comment_id' => $comment->commentable_id, 'commentable_type' => $comment->commentable_type, 'user_id'=> $comment->user_id, 'user' => $comment->user->name, ]; } $attachments = []; foreach ($card->attachments ?? [] as $attachment) { $attachments[] = [ 'id' => $attachment->id, 'attachment' => $attachment->file_path, 'attachment_url' => $attachment->file_path_url, ]; } $collaborators = []; foreach ($this->collaborator ?? [] as $collaborator) { $collaborators[] = [ 'user_id' => $collaborator->user_id, 'owner_id' => $collaborator->owner_id, 'collaboratable_type' => $collaborator->collaboratable_type, 'collaboratable_id' => $collaborator->collaboratable_id, 'role' => $collaborator->role, 'status' => $collaborator->status, 'email' => $collaborator->email, ]; } $chapterCards[] = [ "id" => $card->id, "card_title" => $card->card_title, "card_description" => $card->card_description, 'created_at' => (new \Carbon\Carbon($this->created_at))->format('F d, Y'), 'updated_at' => (new \Carbon\Carbon($this->updated_at))->format('F d, Y'), 'color_id' => $this->color->id, 'color' => $card->color->color, 'color_code' => $card->color->color_code, 'foreground_color' => $this->color->foreground_color, 'image' => $card->image, 'tasks' => $tasks, 'attachments' => $attachments, 'comments' => $comments, 'collaborators' => $collaborate, ]; } $chapters[] = [ "id" => $chapter->id, "chapter_name" => $chapter->chapter_name, "cards" => $chapter->cards, 'color_id' => $chapter->color->id, 'color' => $chapter->color->color, 'color_code' => $chapter->color->color_code, 'foreground_color' => $this->color->foreground_color, 'cards' => $chapterCards ]; } return [ 'id' => $this->id, 'outline_name' => $this->outline_name, 'outline_title' => $this->outline_title, 'description' => $this->description, 'image_id' => $this->image_id, 'image_url' => $this->image ? $this->image->image_url : null, 'book' => $this->book ? [ "book_id" => $this->book->id, "book_name" => $this->book->book_name, ] : [], 'comments'=>$this->comments, 'created_at' => (new \Carbon\Carbon($this->created_at))->format('F d, Y'), 'updated_at' => (new \Carbon\Carbon($this->updated_at))->format('F d, Y'), 'color_id' => $this->color->id, 'color' => $this->color->color, 'color_code' => $this->color->color_code, 'foreground_color' => $this->color->foreground_color, 'collaborators' => $chapter->outline->collaborators ?? null, 'chapters' => $chapters ?? null, ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка