diff --git a/routes/api.php b/routes/api.php index edc79e9d4..624723e0b 100644 --- a/routes/api.php +++ b/routes/api.php @@ -22,8 +22,8 @@ $router->resource('commands', 'CommandController', $actions); }); -$router->group(['namespace' => 'Resources', 'prefix' => 'projects/{project}'], function () use ($router) { - $router->get('commands/{step}', 'CommandController@listing')->name('commands.step'); +$router->group(['namespace' => 'Resources'], function () use ($router) { + $router->get('projects/{project}/commands/{step}', 'CommandController@listing')->name('commands.step'); $router->post('commands/reorder', 'CommandController@reorder')->name('commands.reorder'); }); diff --git a/tests/Integration/Resources/CommandControllerTest.php b/tests/Integration/Resources/CommandControllerTest.php index 4e6a08015..d82eb28d1 100644 --- a/tests/Integration/Resources/CommandControllerTest.php +++ b/tests/Integration/Resources/CommandControllerTest.php @@ -178,7 +178,7 @@ public function testReorder() factory(Command::class)->create(array_merge(['name' => 'Foo', 'order' => 2], $target)); factory(Command::class)->create(array_merge(['name' => 'Bar', 'order' => 1], $target)); - $response = $this->postJson('/projects/1/commands/reorder', ['commands' => [3, 1, 2]]); + $response = $this->postJson('/commands/reorder', ['commands' => [3, 1, 2]]); $response->assertStatus(Response::HTTP_OK)->assertExactJson(['success' => true]); $this->assertDatabaseHas('commands', ['id' => 3, 'name' => 'Bar', 'order' => 0]);