36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class Gallery extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
$data = [];
|
|
$data["id"] = $this->id;
|
|
$data["name"] = $this->name;
|
|
$data["created"] = $this->gallery_create_time;
|
|
$data["url"] = [
|
|
"name" => $this->url,
|
|
"url" => url("/".$this->getTenant()->url."/".$this->url)];
|
|
$data["mainImage"] = [
|
|
"id" => $this->main_image,
|
|
"url" => [
|
|
"small" => url("/".$this->getTenant()->url."/".$this->url."/".$this->main_image."/file?size=small"),
|
|
"medium" => url("/".$this->getTenant()->url."/".$this->url."/".$this->main_image."/file?size=medium"),
|
|
"big" => url("/".$this->getTenant()->url."/".$this->url."/".$this->main_image."/file?size=big")
|
|
]];
|
|
$data["description"] = $this->description;
|
|
$data["tags"] = json_decode($this->tags);
|
|
return $data;
|
|
#return parent::toArray($request);
|
|
}
|
|
}
|