NormResource.php
1 <?php 2 3 namespace App\Http\Resources; 4 5 use Illuminate\Http\Resources\Json\JsonResource; 6 7 class NormResource extends JsonResource 8 { 9 /** 10 * Transform the resource collection into an array. 11 * 12 * @param \Illuminate\Http\Request $request 13 * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable 14 */ 15 public function toArray($request) 16 { 17 return [ 18 'id' => $this->id, 19 'name' => $this->name, 20 'description' => $this->description, 21 'norm_group' => $this->normGroup, 22 'resolutions' => $this->resolutions, 23 'workbooks' => WorkbookResource::collection($this->workbooks), 24 'validation_types' => $this->validationTypes, 25 'norm_scopes' => NormScopeResource::collection($this->normScopes), 26 'activities' => $this->activities, 27 'created_at' => $this->created_at, 28 'updated_at' => $this->updated_at, 29 ]; 30 } 31 }