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 ContactResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
return [
'type' => 'contact',
'id' => (string) $this->id,
id
App\Http\Resources\ContactResource
__get
'attributes' => [
'name' => $this->name,
name
'source' => new UserResource($this->whenLoaded('source')),
'created_at' => $this->created_at,
created_at
'updated_at' => $this->updated_at,
updated_at
],
];
}