Improved display for server view if not installed
This commit is contained in:
parent
be47565c78
commit
fbd1b3f097
3 changed files with 236 additions and 221 deletions
|
@ -341,8 +341,10 @@ class ServersController extends Controller
|
|||
$server = new ServerRepository;
|
||||
$server->toggleInstall($id);
|
||||
Alert::success('Server status was successfully toggled.')->flash();
|
||||
} catch(\Exception $e) {
|
||||
Log::error($e);
|
||||
} catch (\Pterodactyl\Exceptions\DisplayException $ex) {
|
||||
Alert::danger($ex->getMessage())->flash();
|
||||
} catch(\Exception $ex) {
|
||||
Log::error($ex);
|
||||
Alert::danger('An unhandled exception occured while attemping to toggle this servers status.')->flash();
|
||||
} finally {
|
||||
return redirect()->route('admin.servers.view', [
|
||||
|
|
|
@ -696,6 +696,9 @@ class ServerRepository
|
|||
public function toggleInstall($id)
|
||||
{
|
||||
$server = Models\Server::findOrFail($id);
|
||||
if ($server->installed === 2) {
|
||||
throw new DisplayException('This server was marked as having a failed install, you cannot override this.');
|
||||
}
|
||||
$server->installed = ($server->installed === 1) ? 0 : 1;
|
||||
return $server->save();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue