33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class EventMediaResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => (string) $this->id,
|
|
'uuid' => $this->uuid,
|
|
'type' => 'image',
|
|
'collection' => $this->collection,
|
|
'name' => $this->name,
|
|
'mimeType' => $this->mime_type,
|
|
'size' => $this->size,
|
|
'width' => $this->width,
|
|
'height' => $this->height,
|
|
'thumbnailWidth' => $this->thumbnail_width,
|
|
'thumbnailHeight' => $this->thumbnail_height,
|
|
'previewWidth' => $this->preview_width,
|
|
'previewHeight' => $this->preview_height,
|
|
'src' => "/event-media/{$this->id}/thumb",
|
|
'thumbnailUrl' => "/event-media/{$this->id}/thumb",
|
|
'previewUrl' => "/event-media/{$this->id}/preview",
|
|
'originalUrl' => "/event-media/{$this->id}/original",
|
|
'createdAt' => $this->created_at->getTimestampMs(),
|
|
];
|
|
}
|
|
}
|