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

28 lines
751 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class AdminNoticeResource 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,
'title' => $this->title,
'content' => $this->content,
'article_id' => $this->article_id,
'sort' => $this->sort,
'published_at' => $this->published_at ? $this->published_at->timestamp : '',
'created_at' => $this->created_at->timestamp
];
}
}