lcly-data-admin/app/Http/Resources/FriendLinkResource.php

30 lines
805 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class FriendLinkResource 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,
'name' => $this->name,
'type' => $this->type,
'content' => $this->content,
'sort' => $this->sort,
'is_recommend' => $this->is_recommend,
'is_show' => $this->is_show,
'created_at' => strtotime($this->created_at) ?? 0, //录入时间
'is_iframe' => $this->is_iframe,
];
}
}