create/get upload request backend

This commit is contained in:
Čarodej
2022-02-17 10:11:43 +01:00
parent 394a7b6baf
commit 45a3b5415b
13 changed files with 354 additions and 29 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace Domain\UploadRequest\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class UploadRequestResource extends JsonResource
{
public function toArray($request): array
{
return [
'data' => [
'id' => $this->id,
'type' => 'upload-request',
'attributes' => [
'folder_id' => $this->folder_id,
'status' => $this->status,
'email' => $this->email,
'notes' => $this->notes,
],
'relationships' => [
'user' => [
'data' => [
'id' => $this->user->id,
'type' => 'user',
'attributes' => [
'name' => $this->user->settings->name,
'avatar' => $this->user->settings->avatar,
],
],
],
],
],
];
}
}