1
0
Fork 0
internet-everythings-agricu.../app/Http/Resources/BannerResource.php

30 lines
856 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class BannerResource 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,
'place_id' => $this->place_id,
'key' => data_get($this->whenLoaded('place'), 'key'),
'name' => $this->name,
'picture' => $this->picture,
'link_config' => $this->link_config,
'sort' => $this->sort,
'published_at' => $this->published_at ? $this->published_at->timestamp : '',
'created_at' => $this->created_at->timestamp,
];
}
}