generated from liutk/owl-admin-base
28 lines
915 B
PHP
28 lines
915 B
PHP
<?php
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ProjectResource 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,
|
|
'title' => $this->title,
|
|
'description' => $this->description,
|
|
'cover' => $this->cover,
|
|
'children' => ProjectChildrenResource::collection($this->whenLoaded('children')),
|
|
'flows' => ProjectFlowResource::make($this->whenLoaded('flows')),
|
|
'photos' => ProjectPhotoResource::collection($this->whenLoaded('photos')),
|
|
'advances' => ProjectAdvanceResource::collection($this->whenLoaded('advances')),
|
|
];
|
|
}
|
|
}
|