diff --git a/app/Http/Controllers/Api/AirlineController.php b/app/Http/Controllers/Api/AirlineController.php index 4d50f9c3..f96fd782 100644 --- a/app/Http/Controllers/Api/AirlineController.php +++ b/app/Http/Controllers/Api/AirlineController.php @@ -30,7 +30,7 @@ class AirlineController extends Controller */ public function index(Request $request) { - $airports = $this->airlineRepo->whereOrder(['active' => true], 'name'); + $airports = $this->airlineRepo->whereOrder(['active' => true], 'name')->get(); return AirlineResource::collection($airports); } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 484a5e54..30d30be0 100755 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -534,6 +534,9 @@ class RouteServiceProvider extends ServiceProvider Route::get('fleet', 'FleetController@index'); Route::get('fleet/aircraft/{id}', 'FleetController@get_aircraft'); + Route::get('subfleet', 'FleetController@index'); + Route::get('subfleet/aircraft/{id}', 'FleetController@get_aircraft'); + Route::get('flights', 'FlightController@index'); Route::get('flights/search', 'FlightController@search'); Route::get('flights/{id}', 'FlightController@get'); diff --git a/tests/ApiTest.php b/tests/ApiTest.php index 924effc4..7a11d557 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -144,14 +144,14 @@ class ApiTest extends TestCase 'airline_id' => 0, ]); - factory(Airline::class, $size)->create(); + factory(Subfleet::class, $size)->create(); /* * Page 0 and page 1 should return the same thing */ // Test pagination - $res = $this->get('/api/airlines?limit=1&page=0'); + $res = $this->get('/api/fleet?limit=1&page=0'); $this->assertTrue($res->isOk()); $body = $res->json('data'); @@ -159,7 +159,7 @@ class ApiTest extends TestCase $id_first = $body[0]['id']; - $res = $this->get('/api/airlines?limit=1&page=1'); + $res = $this->get('/api/fleet?limit=1&page=1'); $this->assertTrue($res->isOk()); $body = $res->json('data'); @@ -171,7 +171,7 @@ class ApiTest extends TestCase * Page 2 should be different from page 1 */ - $res = $this->get('/api/airlines?limit=1&page=2'); + $res = $this->get('/api/fleet?limit=1&page=2'); $this->assertTrue($res->isOk()); $body = $res->json('data');