2017-12-13 01:49:35 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
use Illuminate\Http\Resources\Json\Resource;
|
|
|
|
|
|
|
|
class Pirep extends Resource
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform the resource into an array.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($request)
|
|
|
|
{
|
2018-01-05 11:21:51 +08:00
|
|
|
$pirep = parent::toArray($request);
|
|
|
|
|
|
|
|
$pirep['airline'] = new Airline($this->airline);
|
|
|
|
$pirep['dpt_airport'] = new Airport($this->dpt_airport);
|
|
|
|
$pirep['arr_airport'] = new Airport($this->arr_airport);
|
|
|
|
$pirep['position'] = new Acars($this->position);
|
2018-01-25 06:22:49 +08:00
|
|
|
$pirep['comments'] = PirepComment::collection($this->comments);
|
2018-01-05 11:21:51 +08:00
|
|
|
|
|
|
|
return $pirep;
|
2017-12-13 01:49:35 +08:00
|
|
|
}
|
|
|
|
}
|