mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class SubTaskResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'master_task_description' => $this->mastertask->description,
|
|
'description' => $this->description,
|
|
'project_code' => $this->mastertask->project->code,
|
|
'master_task_id' => $this->mastertask->id,
|
|
'master_task' => $this->mastertask->title,
|
|
'team_id' => ($this->mastertask->team) ? $this->mastertask->team->id : null,
|
|
'team' => $this->mastertask->team,
|
|
'employee_id' => $this->user->id,
|
|
'duration' => $this->estimated_time,
|
|
'spent_time' => $this->tracked_time,
|
|
'is_finished' => $this->is_finished,
|
|
'timeblocks' => TimeblockResource::collection($this->timeblocks),
|
|
'timesheets' => TimesheetResource::collection($this->timesheets),
|
|
'files' => AttachmentResource::collection($this->attachments),
|
|
'color' => $this->mastertask->color,
|
|
];
|
|
|
|
}
|
|
}
|