append subscription to the UserResource.php

This commit is contained in:
Čarodej
2021-11-19 17:40:57 +01:00
parent 7c5cb79677
commit 4851fb5eab
2 changed files with 55 additions and 29 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Users\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class SettingsResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'data' => [
'id' => $this->id,
'type' => 'settings',
'attributes' => [
'avatar' => $this->avatar,
'name' => $this->name,
'address' => $this->address,
'state' => $this->state,
'city' => $this->city,
'postal_code' => $this->postal_code,
'country' => $this->country,
'phone_number' => $this->phone_number,
'timezone' => $this->timezone,
],
],
];
}
}