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 ThreadResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
return [
'type' => 'thread',
'id' => (string) $this->id,
id
App\Http\Resources\ThreadResource
__get
'attributes' => [
'subject' => $this->subject,
subject
'messages' => MessageResource::collection($this->messages),
messages
'participants' => ParticipantResource::collection($this->participants),
participants
'created_at' => $this->created_at,
created_at
'updated_at' => $this->updated_at,
updated_at
],
];
}