api resource refactoring part 3

This commit is contained in:
Peter Papp
2021-08-27 11:01:44 +02:00
parent 174f2a2c1f
commit d299183ecd
16 changed files with 101 additions and 91 deletions
-26
View File
@@ -84,32 +84,6 @@ class File extends Model
$this->public_access = $token;
}
/**
* Format created at date
*/
public function getCreatedAtAttribute(): string
{
return format_date(
set_time_by_user_timezone($this->attributes['created_at']),
__t('time')
);
}
/**
* Format deleted at date reformat
*/
public function getDeletedAtAttribute(): string | null
{
if (! $this->attributes['deleted_at']) {
return null;
}
return format_date(
set_time_by_user_timezone($this->attributes['deleted_at']),
__t('time')
);
}
/**
* Format fileSize
*/
+5 -2
View File
@@ -29,12 +29,15 @@ class FileResource extends JsonResource
'thumbnail' => $this->thumbnail,
'metadata' => $this->metadata,
'folder_id' => $this->folder_id,
'updated_at' => format_date(
'updated_at' => $this->updated_at,
'created_at' => $this->created_at,
'deleted_at' => $this->deleted_at,
/*'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() => [