mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-25 10:32:31 +01:00
Add toggle install status support
This commit is contained in:
parent
7314e70372
commit
99a67127c9
@ -312,4 +312,21 @@ class ServersController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function postToggleInstall(Request $request, $id)
|
||||
{
|
||||
try {
|
||||
$server = new ServerRepository;
|
||||
$server->toggleInstall($id);
|
||||
Alert::success('Server status was successfully toggled.')->flash();
|
||||
} catch(\Exception $e) {
|
||||
Log::error($e);
|
||||
Alert::danger('An unhandled exception occured while attemping to toggle this servers status.')->flash();
|
||||
} finally {
|
||||
return redirect()->route('admin.servers.view', [
|
||||
'id' => $id,
|
||||
'tab' => 'tab_manage'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,10 @@ class AdminRoutes {
|
||||
$router->post('/new/service-variables', [ 'uses' => 'Admin\ServersController@postNewServerServiceVariables' ]);
|
||||
|
||||
});
|
||||
// Change Install Status
|
||||
$router->post('/view/{id}/installed', [
|
||||
'uses' => 'Admin\ServersController@postToggleInstall'
|
||||
]);
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -575,4 +575,11 @@ class ServerRepository
|
||||
}
|
||||
}
|
||||
|
||||
public function toggleInstall($id)
|
||||
{
|
||||
$server = Models\Server::findOrFail($id);
|
||||
$server->installed = ($server->installed === 1) ? 0 : 1;
|
||||
return $server->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user