for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class ParticipantResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
return [
'type' => 'participant',
'id' => (string) $this->id,
id
App\Http\Resources\ParticipantResource
__get
'attributes' => [
'thread_id' => $this->thread_id,
thread_id
'thread' => new ThreadResource($this->whenLoaded('tread')),
'user_id' => $this->user_id,
user_id
'user' => new UserResource($this->whenLoaded('user')),
'last_read' => $this->last_read,
last_read
'created_at' => $this->created_at,
created_at
'updated_at' => $this->updated_at,
updated_at
],
];
}