July 2018
Intermediate to advanced
420 pages
8h 46m
English
Now, let's create BuildersResource using the make command:
php artisan make:resource BuildersResource
App\Http\Resource\BuildersResource.php.
<?phpnamespace App\Http\Resources;use Illuminate\Http\Resources\Json\JsonResource;class BuildersResource extends JsonResource{ /** * Transform the resource into an array. * * @param \Illuminate\Http\Request $request * @return array */ public function toArray($request) { return [ 'id' => $this->id, 'name' => $this->name, 'description' => $this->description, 'location' => $this->location, ...Read now
Unlock full access