35 lines
968 B
PHP
35 lines
968 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class FileResource extends JsonResource
|
|
{
|
|
public static $wrap = false;
|
|
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
"mime" => $this->mime,
|
|
"path" => $this->path,
|
|
"id" => $this->id,
|
|
"parent_id" => $this->parent_id,
|
|
"name" => $this->name,
|
|
"size" => $this->size,
|
|
"owner" => $this->user->name,
|
|
"is_folder" => $this->is_folder,
|
|
"created_at" => $this->created_at->diffForHumans(),
|
|
"updated_at" => $this->updated_at->diffForHumans(),
|
|
"created_by" => $this->created_by,
|
|
"updated_by" => $this->updated_by,
|
|
"deleted_at" => $this->deleted_at,
|
|
];
|
|
}
|
|
}
|