Add /flight/:id/route resource, returns all route info that's in the navaid database closes #183
This commit is contained in:
24
app/Http/Resources/Navdata.php
Normal file
24
app/Http/Resources/Navdata.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Enums\NavaidType;
|
||||
use Illuminate\Http\Resources\Json\Resource;
|
||||
|
||||
class Navdata extends Resource
|
||||
{
|
||||
public function toArray($request)
|
||||
{
|
||||
$point = parent::toArray($request);
|
||||
|
||||
// Some details about the navaid type
|
||||
$type = [
|
||||
'type' => $point['type'],
|
||||
'name' => NavaidType::label($point['type']),
|
||||
];
|
||||
|
||||
$point['type'] = $type;
|
||||
|
||||
return $point;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user