finish memos cover
This commit is contained in:
33
app/Http/Resources/Image.php
Normal file
33
app/Http/Resources/Image.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class Image extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
'type' => 'images',
|
||||
'image_id' => $this->id,
|
||||
'attributes' => [
|
||||
'path' => url('storage/'.$this->path),
|
||||
'width' => $this->width,
|
||||
'height' => $this->height,
|
||||
'location' => $this->location,
|
||||
]
|
||||
],
|
||||
'links' => [
|
||||
'self' => url('/images/'.$this->id),
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user