<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\ResourceCollection;

class StageOfConstructionCollection extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        $result = [];
        /** @var \App\StageOfConstruction $stageOfConstruction */
        foreach ($this->collection as $key => $stageOfConstruction) {
            $result = [
                'id' => $stageOfConstruction->id,
                'code' => $stageOfConstruction->code,
                'name' => $stageOfConstruction->name
            ];
        }

        return $result;
    }
}
