mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
- added file resource
- frontend refactoring
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Files\Resources;
|
||||
|
||||
use Domain\Sharing\Resources\ShareResource;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FileResource extends JsonResource
|
||||
@@ -15,19 +17,28 @@ class FileResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
'id' => $this->id,
|
||||
'type' => 'file',
|
||||
'attributes' => [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'attributes' => [
|
||||
'name' => $this->name,
|
||||
'basename' => $this->basename,
|
||||
'mimetype' => $this->mimetype,
|
||||
'filesize' => $this->filesize,
|
||||
'type' => $this->type,
|
||||
'file_url' => $this->file_url,
|
||||
'thumbnail' => $this->thumbnail,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->created_at,
|
||||
'metadata' => $this->metadata,
|
||||
'updated_at' => format_date(
|
||||
set_time_by_user_timezone($this->updated_at), __t('time')
|
||||
),
|
||||
'created_at' => format_date(
|
||||
set_time_by_user_timezone($this->created_at), __t('time')
|
||||
),
|
||||
],
|
||||
'relationships' => [
|
||||
$this->mergeWhen($this->shared, fn() => [
|
||||
'shared' => new ShareResource($this->shared),
|
||||
]),
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user