Files
portal/app/Http/Resources/Bookmark.php
2020-08-02 11:22:19 +02:00

35 lines
933 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class Bookmark extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'data' => [
'type' => 'bookmark',
'bookmark_id' => $this->id,
'attributes' => [
'data' => [
'name' => $this->name,
'description' => $this->description,
'url' => $this->url,
'favicon' => $this->favicon,
'created_at' => $this->created_at->diffForHumans(),
'last_updated' => $this->updated_at->diffForHumans(),
]
],
],
];
}
}