30 lines
854 B
PHP
30 lines
854 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1\Carousel\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class CarouselResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->whenHas('id'),
|
|
'title' => $this->whenHas('title'),
|
|
'place' => $this->whenHas('place'),
|
|
'app' => $this->whenHas('app'),
|
|
'link' => $this->whenHas('link'),
|
|
'resource_id' => $this->whenHas('resource_id'),
|
|
'resource_type' => $this->whenHas('resource_type'),
|
|
'thumbnail' => $this->thumbnail('650x650'),
|
|
'image' => $this->getFirstMediaUrl('main'),
|
|
];
|
|
}
|
|
}
|