Fix up routes and controller names

This commit is contained in:
Dane Everitt 2017-04-09 19:13:22 -04:00
parent 722fd614a1
commit 1e43f2049b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
10 changed files with 58 additions and 60 deletions

View file

@ -60,7 +60,7 @@ class NodesController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse * @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse
*/ */
public function new(Request $request) public function create(Request $request)
{ {
$locations = Models\Location::all(); $locations = Models\Location::all();
if (! $locations->count()) { if (! $locations->count()) {
@ -78,7 +78,7 @@ class NodesController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function create(Request $request) public function store(Request $request)
{ {
try { try {
$repo = new NodeRepository; $repo = new NodeRepository;

View file

@ -44,7 +44,7 @@ class OptionController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function new(Request $request) public function create(Request $request)
{ {
$services = Service::with('options')->get(); $services = Service::with('options')->get();
Javascript::put(['services' => $services->keyBy('id')]); Javascript::put(['services' => $services->keyBy('id')]);
@ -58,7 +58,7 @@ class OptionController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Response\RedirectResponse
*/ */
public function create(Request $request) public function store(Request $request)
{ {
$repo = new OptionRepository; $repo = new OptionRepository;

View file

@ -60,7 +60,7 @@ class PackController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function new(Request $request) public function create(Request $request)
{ {
return view('admin.packs.new', [ return view('admin.packs.new', [
'services' => Service::with('options')->get(), 'services' => Service::with('options')->get(),
@ -86,7 +86,7 @@ class PackController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function create(Request $request) public function store(Request $request)
{ {
$repo = new PackRepository; $repo = new PackRepository;

View file

@ -63,7 +63,7 @@ class ServersController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function new(Request $request) public function create(Request $request)
{ {
$services = Models\Service::with('options.packs', 'options.variables')->get(); $services = Models\Service::with('options.packs', 'options.variables')->get();
Javascript::put([ Javascript::put([
@ -86,7 +86,7 @@ class ServersController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Response\RedirectResponse
*/ */
public function create(Request $request) public function store(Request $request)
{ {
try { try {
$repo = new ServerRepository; $repo = new ServerRepository;
@ -114,7 +114,7 @@ class ServersController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return array * @return array
*/ */
public function newServerNodes(Request $request) public function nodes(Request $request)
{ {
$nodes = Models\Node::with('allocations')->where('location_id', $request->input('location'))->get(); $nodes = Models\Node::with('allocations')->where('location_id', $request->input('location'))->get();

View file

@ -54,7 +54,7 @@ class ServiceController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function new(Request $request) public function create(Request $request)
{ {
return view('admin.services.new'); return view('admin.services.new');
} }
@ -91,7 +91,7 @@ class ServiceController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function create(Request $request) public function store(Request $request)
{ {
$repo = new ServiceRepository; $repo = new ServiceRepository;

View file

@ -42,7 +42,7 @@ class UserController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function getIndex(Request $request) public function index(Request $request)
{ {
$users = User::withCount('servers'); $users = User::withCount('servers');
@ -61,7 +61,7 @@ class UserController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function getNew(Request $request) public function create(Request $request)
{ {
return view('admin.users.new'); return view('admin.users.new');
} }
@ -73,7 +73,7 @@ class UserController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function getView(Request $request, $id) public function view(Request $request, $id)
{ {
return view('admin.users.view', [ return view('admin.users.view', [
'user' => User::with('servers.node')->findOrFail($id), 'user' => User::with('servers.node')->findOrFail($id),
@ -87,7 +87,7 @@ class UserController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function deleteUser(Request $request, $id) public function delete(Request $request, $id)
{ {
try { try {
$repo = new UserRepository; $repo = new UserRepository;
@ -111,7 +111,7 @@ class UserController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function postNew(Request $request) public function store(Request $request)
{ {
try { try {
$user = new UserRepository; $user = new UserRepository;
@ -139,7 +139,7 @@ class UserController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function updateUser(Request $request, $id) public function update(Request $request, $id)
{ {
try { try {
$repo = new UserRepository; $repo = new UserRepository;
@ -164,7 +164,7 @@ class UserController extends Controller
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Pterodactyl\Models\User * @return \Pterodactyl\Models\User
*/ */
public function getJson(Request $request) public function json(Request $request)
{ {
return User::select('id', 'email', 'username', 'name_first', 'name_last') return User::select('id', 'email', 'username', 'name_first', 'name_last')
->search($request->input('q')) ->search($request->input('q'))

View file

@ -43,7 +43,7 @@ class SubuserController extends Controller
* @param string $uuid * @param string $uuid
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function getIndex(Request $request, $uuid) public function index(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid)->load('subusers.user'); $server = Models\Server::byUuid($uuid)->load('subusers.user');
$this->authorize('list-subusers', $server); $this->authorize('list-subusers', $server);
@ -65,7 +65,7 @@ class SubuserController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\View\View * @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'); $server = Models\Server::byUuid($uuid)->load('node');
$this->authorize('view-subuser', $server); $this->authorize('view-subuser', $server);
@ -94,7 +94,7 @@ class SubuserController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function postView(Request $request, $uuid, $id) public function update(Request $request, $uuid, $id)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
$this->authorize('edit-subuser', $server); $this->authorize('edit-subuser', $server);
@ -139,7 +139,7 @@ class SubuserController extends Controller
* @param string $uuid * @param string $uuid
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function getNew(Request $request, $uuid) public function create(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
$this->authorize('create-subuser', $server); $this->authorize('create-subuser', $server);
@ -159,7 +159,7 @@ class SubuserController extends Controller
* @param string $uuid * @param string $uuid
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function postNew(Request $request, $uuid) public function store(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
$this->authorize('create-subuser', $server); $this->authorize('create-subuser', $server);
@ -195,7 +195,7 @@ class SubuserController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response * @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); $server = Models\Server::byUuid($uuid);
$this->authorize('delete-subuser', $server); $this->authorize('delete-subuser', $server);

View file

@ -42,7 +42,7 @@ class TaskController extends Controller
* @param string $uuid * @param string $uuid
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function getIndex(Request $request, $uuid) public function index(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid)->load('tasks'); $server = Models\Server::byUuid($uuid)->load('tasks');
$this->authorize('list-tasks', $server); $this->authorize('list-tasks', $server);
@ -66,7 +66,7 @@ class TaskController extends Controller
* @param string $uuid * @param string $uuid
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function getNew(Request $request, $uuid) public function create(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
$this->authorize('create-task', $server); $this->authorize('create-task', $server);
@ -85,7 +85,7 @@ class TaskController extends Controller
* @param string $uuid * @param string $uuid
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function postNew(Request $request, $uuid) public function store(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
$this->authorize('create-task', $server); $this->authorize('create-task', $server);
@ -117,7 +117,7 @@ class TaskController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\JsonResponse * @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'); $server = Models\Server::byUuid($uuid)->load('tasks');
$this->authorize('delete-task', $server); $this->authorize('delete-task', $server);
@ -151,7 +151,7 @@ class TaskController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\JsonResponse * @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'); $server = Models\Server::byUuid($uuid)->load('tasks');
$this->authorize('toggle-task', $server); $this->authorize('toggle-task', $server);

View file

@ -79,15 +79,15 @@ Route::group(['prefix' => 'settings'], function () {
| |
*/ */
Route::group(['prefix' => 'users'], function () { Route::group(['prefix' => 'users'], function () {
Route::get('/', 'UserController@getIndex')->name('admin.users'); Route::get('/', 'UserController@index')->name('admin.users');
Route::get('/accounts.json', 'UserController@getJson')->name('admin.users.json'); Route::get('/accounts.json', 'UserController@json')->name('admin.users.json');
Route::get('/new', 'UserController@getNew')->name('admin.users.new'); Route::get('/new', 'UserController@create')->name('admin.users.new');
Route::get('/view/{id}', 'UserController@getView')->name('admin.users.view'); Route::get('/view/{id}', 'UserController@view')->name('admin.users.view');
Route::post('/new', 'UserController@postNew'); Route::post('/new', 'UserController@store');
Route::post('/view/{id}', 'UserController@updateUser'); 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::group(['prefix' => 'servers'], function () {
Route::get('/', 'ServersController@index')->name('admin.servers'); Route::get('/', 'ServersController@index')->name('admin.servers');
Route::get('/new', 'ServersController@new')->name('admin.servers.new'); Route::get('/new', 'ServersController@create')->name('admin.servers.new');
Route::get('/new/nodes', 'ServersController@newServerNodes')->name('admin.servers.new.nodes'); 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}', 'ServersController@viewIndex')->name('admin.servers.view');
Route::get('/view/{id}/details', 'ServersController@viewDetails')->name('admin.servers.view.details'); Route::get('/view/{id}/details', 'ServersController@viewDetails')->name('admin.servers.view.details');
Route::get('/view/{id}/build', 'ServersController@viewBuild')->name('admin.servers.view.build'); 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}/manage', 'ServersController@viewManage')->name('admin.servers.view.manage');
Route::get('/view/{id}/delete', 'ServersController@viewDelete')->name('admin.servers.view.delete'); 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', 'ServersController@setDetails');
Route::post('/view/{id}/details/container', 'ServersController@setContainer')->name('admin.servers.view.details.container'); Route::post('/view/{id}/details/container', 'ServersController@setContainer')->name('admin.servers.view.details.container');
Route::post('/view/{id}/build', 'ServersController@updateBuild'); Route::post('/view/{id}/build', 'ServersController@updateBuild');
@ -136,7 +136,7 @@ Route::group(['prefix' => 'servers'], function () {
*/ */
Route::group(['prefix' => 'nodes'], function () { Route::group(['prefix' => 'nodes'], function () {
Route::get('/', 'NodesController@index')->name('admin.nodes'); 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}', 'NodesController@viewIndex')->name('admin.nodes.view');
Route::get('/view/{id}/settings', 'NodesController@viewSettings')->name('admin.nodes.view.settings'); Route::get('/view/{id}/settings', 'NodesController@viewSettings')->name('admin.nodes.view.settings');
Route::get('/view/{id}/configuration', 'NodesController@viewConfiguration')->name('admin.nodes.view.configuration'); 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}/servers', 'NodesController@viewServers')->name('admin.nodes.view.servers');
Route::get('/view/{id}/settings/token', 'NodesController@setToken')->name('admin.nodes.view.configuration.token'); 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}/settings', 'NodesController@updateSettings');
Route::post('/view/{id}/allocation', 'NodesController@createAllocation'); Route::post('/view/{id}/allocation', 'NodesController@createAllocation');
Route::post('/view/{id}/allocation/remove', 'NodesController@allocationRemoveBlock')->name('admin.nodes.view.allocation.removeBlock'); 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::group(['prefix' => 'services'], function () {
Route::get('/', 'ServiceController@index')->name('admin.services'); 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}', 'ServiceController@view')->name('admin.services.view');
Route::get('/view/{id}/functions', 'ServiceController@viewFunctions')->name('admin.services.view.functions'); 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}', 'OptionController@viewConfiguration')->name('admin.services.option.view');
Route::get('/option/{id}/variables', 'OptionController@viewVariables')->name('admin.services.option.variables'); 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('/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}', 'OptionController@editConfiguration');
Route::post('/option/{id}/variables', 'OptionController@createVariable'); Route::post('/option/{id}/variables', 'OptionController@createVariable');
Route::post('/option/{id}/variables/{variable}', 'OptionController@editVariable')->name('admin.services.option.variables.edit'); 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::group(['prefix' => 'packs'], function () {
Route::get('/', 'PackController@index')->name('admin.packs'); 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('/new/template', 'PackController@newTemplate')->name('admin.packs.new.template');
Route::get('/view/{id}', 'PackController@view')->name('admin.packs.view'); 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}', 'PackController@update');
Route::post('/view/{id}/export/{files?}', 'PackController@export')->name('admin.packs.view.export'); Route::post('/view/{id}/export/{files?}', 'PackController@export')->name('admin.packs.view.export');
}); });

View file

@ -71,14 +71,14 @@ Route::group(['prefix' => 'files'], function () {
| |
*/ */
Route::group(['prefix' => 'users'], function () { Route::group(['prefix' => 'users'], function () {
Route::get('/', 'SubuserController@getIndex')->name('server.subusers'); Route::get('/', 'SubuserController@index')->name('server.subusers');
Route::get('/new', 'SubuserController@getNew')->name('server.subusers.new'); Route::get('/new', 'SubuserController@create')->name('server.subusers.new');
Route::get('/view/{id}', 'SubuserController@getView')->name('server.subusers.view'); Route::get('/view/{id}', 'SubuserController@view')->name('server.subusers.view');
Route::post('/new', 'SubuserController@postNew'); Route::post('/new', 'SubuserController@store');
Route::post('/view/{id}', 'SubuserController@postView'); 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::group(['prefix' => 'tasks'], function () {
Route::get('/', 'TaskController@getIndex')->name('server.tasks'); Route::get('/', 'TaskController@index')->name('server.tasks');
Route::get('/new', 'TaskController@getNew')->name('server.tasks.new'); Route::get('/new', 'TaskController@create')->name('server.tasks.new');
Route::get('/view/{id}', 'TaskController@getView')->name('server.tasks.view');
Route::post('/new', 'TaskController@postNew'); Route::post('/new', 'TaskController@store');
Route::post('/view/{id}', 'SubuserController@postView'); Route::post('/toggle/{id}', 'TaskController@toggle')->name('server.tasks.toggle');
Route::post('/toggle/{id}', 'TaskController@toggleTask')->name('server.tasks.toggle');
Route::delete('/delete/{id}', 'TaskController@deleteTask')->name('server.tasks.delete'); Route::delete('/delete/{id}', 'TaskController@delete')->name('server.tasks.delete');
}); });
/* /*