34 lines
872 B
PHP
34 lines
872 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,
|
|
'url' => $this->url,
|
|
'favicon' => $this->favicon,
|
|
'created_at' => $this->created_at->diffForHumans(),
|
|
'last_updated' => $this->updated_at->diffForHumans(),
|
|
]
|
|
],
|
|
],
|
|
];
|
|
}
|
|
}
|