Flight/Subfleet fares not returning in API #899 (#900)

Make sure proper fares are returned from the API #899
This commit is contained in:
Nabeel S
2020-10-24 15:11:08 -04:00
committed by GitHub
parent b83f7dcac8
commit 1be68d1e63
13 changed files with 206 additions and 95 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Resources;
use App\Contracts\Resource;
use App\Services\FareService;
/**
* @mixin \App\Models\Fare
@@ -11,13 +12,17 @@ class Fare extends Resource
{
public function toArray($request)
{
/** @var FareService $fareSvc */
$fareSvc = app(FareService::class);
$fare = $fareSvc->getFares($this);
return [
'id' => $this->id,
'code' => $this->code,
'name' => $this->name,
'price' => $this->price,
'cost' => $this->cost,
'capacity' => $this->capacity,
'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,