mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-14 09:01:42 -04:00
59 lines
2.0 KiB
PHP
59 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\StudioPlus\Transformers;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Modules\StudioPlus\Entities\StudioPlusCategory;
|
|
use Modules\StudioPlus\Entities\StudioPlusThumbnail;
|
|
|
|
class StudioPlusVideoResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
// return parent::toArray($request);
|
|
|
|
$types = collect($this->types);
|
|
|
|
if ($this->is_short) {
|
|
$types->push('SHORTS');
|
|
}
|
|
|
|
return [
|
|
'id' => $this->id,
|
|
'title' => $this->title,
|
|
'description' => $this->description,
|
|
'asin' => $this->asin,
|
|
'product_name' => $this->product_name,
|
|
'amazon_url' => $this->amazon_url,
|
|
'visibility' => $this->visibility,
|
|
'status' => $this->status,
|
|
'created_at' => $this->created_at,
|
|
'video_url' => $this->video_url,
|
|
'original_video_url' => $this->original_video_url,
|
|
'types' => $this->types,
|
|
'video_types' => $types->join(', '),
|
|
'amazon_total_reviews' => $this->amazon_total_reviews,
|
|
'studio_plus_category_id' => $this->studio_plus_category_id,
|
|
'studio_plus_asin_id' => $this->studio_plus_asin_id,
|
|
'global_setting_id' => $this->global_setting_id,
|
|
'filename' => $this->filename,
|
|
'asin_data' => $this->whenLoaded('asinData'),
|
|
'category' => $this->whenLoaded('category'),
|
|
'thumbnail' => $this->whenLoaded('thumbnail'),
|
|
'thumbnails' => $this->whenLoaded('thumbnails'),
|
|
'channel' => $this->whenLoaded('channel'),
|
|
'upload_status' => $this->upload_status,
|
|
'brand' => $this->brand,
|
|
'job_request_id' => $this->job_request_id,
|
|
'is_short' => $this->is_short,
|
|
'old' => $this->old
|
|
];
|
|
}
|
|
}
|