Add toggle install status support
This commit is contained in:
parent
7314e70372
commit
99a67127c9
3 changed files with 28 additions and 0 deletions
|
@ -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' ]);
|
$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 a new issue