phpvms/app/Http/Resources/Fare.php
Nabeel S 1be68d1e63
Flight/Subfleet fares not returning in API #899 (#900)
Make sure proper fares are returned from the API #899
2020-10-24 15:11:08 -04:00

32 lines
728 B
PHP

<?php
namespace App\Http\Resources;
use App\Contracts\Resource;
use App\Services\FareService;
/**
* @mixin \App\Models\Fare
*/
class Fare extends Resource
{
public function toArray($request)
{
/** @var FareService $fareSvc */
$fareSvc = app(FareService::class);
$fare = $fareSvc->getFares($this);
return [
'id' => $fare->id,
'code' => $fare->code,
'name' => $fare->name,
'capacity' => $fare->capacity,
'cost' => $fare->cost,
'price' => $fare->price,
'type' => $this->type,
'notes' => $this->notes,
'active' => $this->active,
];
}
}