From 1e43f2049bdc18f5f2970e271322970eb1ad66b7 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 9 Apr 2017 19:13:22 -0400 Subject: [PATCH] Fix up routes and controller names --- .../Controllers/Admin/NodesController.php | 4 +-- .../Controllers/Admin/OptionController.php | 4 +-- app/Http/Controllers/Admin/PackController.php | 4 +-- .../Controllers/Admin/ServersController.php | 6 ++-- .../Controllers/Admin/ServiceController.php | 4 +-- app/Http/Controllers/Admin/UserController.php | 14 ++++---- .../Controllers/Server/SubuserController.php | 12 +++---- .../Controllers/Server/TaskController.php | 10 +++--- routes/admin.php | 36 +++++++++---------- routes/server.php | 24 ++++++------- 10 files changed, 58 insertions(+), 60 deletions(-) diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index 0c895fe15..1300b9643 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -60,7 +60,7 @@ class NodesController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse */ - public function new(Request $request) + public function create(Request $request) { $locations = Models\Location::all(); if (! $locations->count()) { @@ -78,7 +78,7 @@ class NodesController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse */ - public function create(Request $request) + public function store(Request $request) { try { $repo = new NodeRepository; diff --git a/app/Http/Controllers/Admin/OptionController.php b/app/Http/Controllers/Admin/OptionController.php index 4dfe34321..d4f383a92 100644 --- a/app/Http/Controllers/Admin/OptionController.php +++ b/app/Http/Controllers/Admin/OptionController.php @@ -44,7 +44,7 @@ class OptionController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ - public function new(Request $request) + public function create(Request $request) { $services = Service::with('options')->get(); Javascript::put(['services' => $services->keyBy('id')]); @@ -58,7 +58,7 @@ class OptionController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\Response\RedirectResponse */ - public function create(Request $request) + public function store(Request $request) { $repo = new OptionRepository; diff --git a/app/Http/Controllers/Admin/PackController.php b/app/Http/Controllers/Admin/PackController.php index 14d248dc8..d02273672 100644 --- a/app/Http/Controllers/Admin/PackController.php +++ b/app/Http/Controllers/Admin/PackController.php @@ -60,7 +60,7 @@ class PackController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ - public function new(Request $request) + public function create(Request $request) { return view('admin.packs.new', [ 'services' => Service::with('options')->get(), @@ -86,7 +86,7 @@ class PackController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ - public function create(Request $request) + public function store(Request $request) { $repo = new PackRepository; diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index 1016f802c..85bc1a4db 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -63,7 +63,7 @@ class ServersController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ - public function new(Request $request) + public function create(Request $request) { $services = Models\Service::with('options.packs', 'options.variables')->get(); Javascript::put([ @@ -86,7 +86,7 @@ class ServersController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\Response\RedirectResponse */ - public function create(Request $request) + public function store(Request $request) { try { $repo = new ServerRepository; @@ -114,7 +114,7 @@ class ServersController extends Controller * @param \Illuminate\Http\Request $request * @return array */ - public function newServerNodes(Request $request) + public function nodes(Request $request) { $nodes = Models\Node::with('allocations')->where('location_id', $request->input('location'))->get(); diff --git a/app/Http/Controllers/Admin/ServiceController.php b/app/Http/Controllers/Admin/ServiceController.php index 2e63e5306..beaac5340 100644 --- a/app/Http/Controllers/Admin/ServiceController.php +++ b/app/Http/Controllers/Admin/ServiceController.php @@ -54,7 +54,7 @@ class ServiceController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ - public function new(Request $request) + public function create(Request $request) { return view('admin.services.new'); } @@ -91,7 +91,7 @@ class ServiceController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse */ - public function create(Request $request) + public function store(Request $request) { $repo = new ServiceRepository; diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index f7324456b..238f2e1e2 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -42,7 +42,7 @@ class UserController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ - public function getIndex(Request $request) + public function index(Request $request) { $users = User::withCount('servers'); @@ -61,7 +61,7 @@ class UserController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\View\View */ - public function getNew(Request $request) + public function create(Request $request) { return view('admin.users.new'); } @@ -73,7 +73,7 @@ class UserController extends Controller * @param int $id * @return \Illuminate\View\View */ - public function getView(Request $request, $id) + public function view(Request $request, $id) { return view('admin.users.view', [ 'user' => User::with('servers.node')->findOrFail($id), @@ -87,7 +87,7 @@ class UserController extends Controller * @param int $id * @return \Illuminate\Http\RedirectResponse */ - public function deleteUser(Request $request, $id) + public function delete(Request $request, $id) { try { $repo = new UserRepository; @@ -111,7 +111,7 @@ class UserController extends Controller * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse */ - public function postNew(Request $request) + public function store(Request $request) { try { $user = new UserRepository; @@ -139,7 +139,7 @@ class UserController extends Controller * @param int $id * @return \Illuminate\Http\RedirectResponse */ - public function updateUser(Request $request, $id) + public function update(Request $request, $id) { try { $repo = new UserRepository; @@ -164,7 +164,7 @@ class UserController extends Controller * @param \Illuminate\Http\Request $request * @return \Pterodactyl\Models\User */ - public function getJson(Request $request) + public function json(Request $request) { return User::select('id', 'email', 'username', 'name_first', 'name_last') ->search($request->input('q')) diff --git a/app/Http/Controllers/Server/SubuserController.php b/app/Http/Controllers/Server/SubuserController.php index 3caba0e0e..c0c15f29d 100644 --- a/app/Http/Controllers/Server/SubuserController.php +++ b/app/Http/Controllers/Server/SubuserController.php @@ -43,7 +43,7 @@ class SubuserController extends Controller * @param string $uuid * @return \Illuminate\View\View */ - public function getIndex(Request $request, $uuid) + public function index(Request $request, $uuid) { $server = Models\Server::byUuid($uuid)->load('subusers.user'); $this->authorize('list-subusers', $server); @@ -65,7 +65,7 @@ class SubuserController extends Controller * @param int $id * @return \Illuminate\View\View */ - public function getView(Request $request, $uuid, $id) + public function view(Request $request, $uuid, $id) { $server = Models\Server::byUuid($uuid)->load('node'); $this->authorize('view-subuser', $server); @@ -94,7 +94,7 @@ class SubuserController extends Controller * @param int $id * @return \Illuminate\Http\RedirectResponse */ - public function postView(Request $request, $uuid, $id) + public function update(Request $request, $uuid, $id) { $server = Models\Server::byUuid($uuid); $this->authorize('edit-subuser', $server); @@ -139,7 +139,7 @@ class SubuserController extends Controller * @param string $uuid * @return \Illuminate\View\View */ - public function getNew(Request $request, $uuid) + public function create(Request $request, $uuid) { $server = Models\Server::byUuid($uuid); $this->authorize('create-subuser', $server); @@ -159,7 +159,7 @@ class SubuserController extends Controller * @param string $uuid * @return \Illuminate\Http\RedirectResponse */ - public function postNew(Request $request, $uuid) + public function store(Request $request, $uuid) { $server = Models\Server::byUuid($uuid); $this->authorize('create-subuser', $server); @@ -195,7 +195,7 @@ class SubuserController extends Controller * @param int $id * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response */ - public function deleteSubuser(Request $request, $uuid, $id) + public function delete(Request $request, $uuid, $id) { $server = Models\Server::byUuid($uuid); $this->authorize('delete-subuser', $server); diff --git a/app/Http/Controllers/Server/TaskController.php b/app/Http/Controllers/Server/TaskController.php index 1ddc3eac2..1bd7f3244 100644 --- a/app/Http/Controllers/Server/TaskController.php +++ b/app/Http/Controllers/Server/TaskController.php @@ -42,7 +42,7 @@ class TaskController extends Controller * @param string $uuid * @return \Illuminate\View\View */ - public function getIndex(Request $request, $uuid) + public function index(Request $request, $uuid) { $server = Models\Server::byUuid($uuid)->load('tasks'); $this->authorize('list-tasks', $server); @@ -66,7 +66,7 @@ class TaskController extends Controller * @param string $uuid * @return \Illuminate\View\View */ - public function getNew(Request $request, $uuid) + public function create(Request $request, $uuid) { $server = Models\Server::byUuid($uuid); $this->authorize('create-task', $server); @@ -85,7 +85,7 @@ class TaskController extends Controller * @param string $uuid * @return \Illuminate\Http\RedirectResponse */ - public function postNew(Request $request, $uuid) + public function store(Request $request, $uuid) { $server = Models\Server::byUuid($uuid); $this->authorize('create-task', $server); @@ -117,7 +117,7 @@ class TaskController extends Controller * @param int $id * @return \Illuminate\Http\JsonResponse */ - public function deleteTask(Request $request, $uuid, $id) + public function delete(Request $request, $uuid, $id) { $server = Models\Server::byUuid($uuid)->load('tasks'); $this->authorize('delete-task', $server); @@ -151,7 +151,7 @@ class TaskController extends Controller * @param int $id * @return \Illuminate\Http\JsonResponse */ - public function toggleTask(Request $request, $uuid, $id) + public function toggle(Request $request, $uuid, $id) { $server = Models\Server::byUuid($uuid)->load('tasks'); $this->authorize('toggle-task', $server); diff --git a/routes/admin.php b/routes/admin.php index a940c8617..96fa47256 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -79,15 +79,15 @@ Route::group(['prefix' => 'settings'], function () { | */ Route::group(['prefix' => 'users'], function () { - Route::get('/', 'UserController@getIndex')->name('admin.users'); - Route::get('/accounts.json', 'UserController@getJson')->name('admin.users.json'); - Route::get('/new', 'UserController@getNew')->name('admin.users.new'); - Route::get('/view/{id}', 'UserController@getView')->name('admin.users.view'); + Route::get('/', 'UserController@index')->name('admin.users'); + Route::get('/accounts.json', 'UserController@json')->name('admin.users.json'); + Route::get('/new', 'UserController@create')->name('admin.users.new'); + Route::get('/view/{id}', 'UserController@view')->name('admin.users.view'); - Route::post('/new', 'UserController@postNew'); - Route::post('/view/{id}', 'UserController@updateUser'); + Route::post('/new', 'UserController@store'); + Route::post('/view/{id}', 'UserController@update'); - Route::delete('/view/{id}', 'UserController@deleteUser'); + Route::delete('/view/{id}', 'UserController@delete'); }); /* @@ -100,8 +100,8 @@ Route::group(['prefix' => 'users'], function () { */ Route::group(['prefix' => 'servers'], function () { Route::get('/', 'ServersController@index')->name('admin.servers'); - Route::get('/new', 'ServersController@new')->name('admin.servers.new'); - Route::get('/new/nodes', 'ServersController@newServerNodes')->name('admin.servers.new.nodes'); + Route::get('/new', 'ServersController@create')->name('admin.servers.new'); + Route::get('/new/nodes', 'ServersController@nodes')->name('admin.servers.new.nodes'); Route::get('/view/{id}', 'ServersController@viewIndex')->name('admin.servers.view'); Route::get('/view/{id}/details', 'ServersController@viewDetails')->name('admin.servers.view.details'); Route::get('/view/{id}/build', 'ServersController@viewBuild')->name('admin.servers.view.build'); @@ -110,7 +110,7 @@ Route::group(['prefix' => 'servers'], function () { Route::get('/view/{id}/manage', 'ServersController@viewManage')->name('admin.servers.view.manage'); Route::get('/view/{id}/delete', 'ServersController@viewDelete')->name('admin.servers.view.delete'); - Route::post('/new', 'ServersController@create'); + Route::post('/new', 'ServersController@store'); Route::post('/view/{id}/details', 'ServersController@setDetails'); Route::post('/view/{id}/details/container', 'ServersController@setContainer')->name('admin.servers.view.details.container'); Route::post('/view/{id}/build', 'ServersController@updateBuild'); @@ -136,7 +136,7 @@ Route::group(['prefix' => 'servers'], function () { */ Route::group(['prefix' => 'nodes'], function () { Route::get('/', 'NodesController@index')->name('admin.nodes'); - Route::get('/new', 'NodesController@new')->name('admin.nodes.new'); + Route::get('/new', 'NodesController@create')->name('admin.nodes.new'); Route::get('/view/{id}', 'NodesController@viewIndex')->name('admin.nodes.view'); Route::get('/view/{id}/settings', 'NodesController@viewSettings')->name('admin.nodes.view.settings'); Route::get('/view/{id}/configuration', 'NodesController@viewConfiguration')->name('admin.nodes.view.configuration'); @@ -144,7 +144,7 @@ Route::group(['prefix' => 'nodes'], function () { Route::get('/view/{id}/servers', 'NodesController@viewServers')->name('admin.nodes.view.servers'); Route::get('/view/{id}/settings/token', 'NodesController@setToken')->name('admin.nodes.view.configuration.token'); - Route::post('/new', 'NodesController@create'); + Route::post('/new', 'NodesController@store'); Route::post('/view/{id}/settings', 'NodesController@updateSettings'); Route::post('/view/{id}/allocation', 'NodesController@createAllocation'); Route::post('/view/{id}/allocation/remove', 'NodesController@allocationRemoveBlock')->name('admin.nodes.view.allocation.removeBlock'); @@ -164,16 +164,16 @@ Route::group(['prefix' => 'nodes'], function () { */ Route::group(['prefix' => 'services'], function () { Route::get('/', 'ServiceController@index')->name('admin.services'); - Route::get('/new', 'ServiceController@new')->name('admin.services.new'); + Route::get('/new', 'ServiceController@create')->name('admin.services.new'); Route::get('/view/{id}', 'ServiceController@view')->name('admin.services.view'); Route::get('/view/{id}/functions', 'ServiceController@viewFunctions')->name('admin.services.view.functions'); - Route::get('/option/new', 'OptionController@new')->name('admin.services.option.new'); + Route::get('/option/new', 'OptionController@create')->name('admin.services.option.new'); Route::get('/option/{id}', 'OptionController@viewConfiguration')->name('admin.services.option.view'); Route::get('/option/{id}/variables', 'OptionController@viewVariables')->name('admin.services.option.variables'); - Route::post('/new', 'ServiceController@create'); + Route::post('/new', 'ServiceController@store'); Route::post('/view/{id}', 'ServiceController@edit'); - Route::post('/option/new', 'OptionController@new'); + Route::post('/option/new', 'OptionController@store'); Route::post('/option/{id}', 'OptionController@editConfiguration'); Route::post('/option/{id}/variables', 'OptionController@createVariable'); Route::post('/option/{id}/variables/{variable}', 'OptionController@editVariable')->name('admin.services.option.variables.edit'); @@ -191,11 +191,11 @@ Route::group(['prefix' => 'services'], function () { */ Route::group(['prefix' => 'packs'], function () { Route::get('/', 'PackController@index')->name('admin.packs'); - Route::get('/new', 'PackController@new')->name('admin.packs.new'); + Route::get('/new', 'PackController@create')->name('admin.packs.new'); Route::get('/new/template', 'PackController@newTemplate')->name('admin.packs.new.template'); Route::get('/view/{id}', 'PackController@view')->name('admin.packs.view'); - Route::post('/new', 'PackController@create'); + Route::post('/new', 'PackController@store'); Route::post('/view/{id}', 'PackController@update'); Route::post('/view/{id}/export/{files?}', 'PackController@export')->name('admin.packs.view.export'); }); diff --git a/routes/server.php b/routes/server.php index cf46054cb..75fc56c7d 100644 --- a/routes/server.php +++ b/routes/server.php @@ -71,14 +71,14 @@ Route::group(['prefix' => 'files'], function () { | */ Route::group(['prefix' => 'users'], function () { - Route::get('/', 'SubuserController@getIndex')->name('server.subusers'); - Route::get('/new', 'SubuserController@getNew')->name('server.subusers.new'); - Route::get('/view/{id}', 'SubuserController@getView')->name('server.subusers.view'); + Route::get('/', 'SubuserController@index')->name('server.subusers'); + Route::get('/new', 'SubuserController@create')->name('server.subusers.new'); + Route::get('/view/{id}', 'SubuserController@view')->name('server.subusers.view'); - Route::post('/new', 'SubuserController@postNew'); - Route::post('/view/{id}', 'SubuserController@postView'); + Route::post('/new', 'SubuserController@store'); + Route::post('/view/{id}', 'SubuserController@update'); - Route::delete('/delete/{id}', 'SubuserController@deleteSubuser')->name('server.subusers.delete'); + Route::delete('/delete/{id}', 'SubuserController@delete')->name('server.subusers.delete'); }); /* @@ -90,15 +90,13 @@ Route::group(['prefix' => 'users'], function () { | */ Route::group(['prefix' => 'tasks'], function () { - Route::get('/', 'TaskController@getIndex')->name('server.tasks'); - Route::get('/new', 'TaskController@getNew')->name('server.tasks.new'); - Route::get('/view/{id}', 'TaskController@getView')->name('server.tasks.view'); + Route::get('/', 'TaskController@index')->name('server.tasks'); + Route::get('/new', 'TaskController@create')->name('server.tasks.new'); - Route::post('/new', 'TaskController@postNew'); - Route::post('/view/{id}', 'SubuserController@postView'); - Route::post('/toggle/{id}', 'TaskController@toggleTask')->name('server.tasks.toggle'); + Route::post('/new', 'TaskController@store'); + Route::post('/toggle/{id}', 'TaskController@toggle')->name('server.tasks.toggle'); - Route::delete('/delete/{id}', 'TaskController@deleteTask')->name('server.tasks.delete'); + Route::delete('/delete/{id}', 'TaskController@delete')->name('server.tasks.delete'); }); /*