Complete new service, option, and variable management interface in Admin CP

This commit is contained in:
Dane Everitt 2017-03-12 00:00:06 -05:00
parent bccbb309b2
commit d7682bb7c9
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
16 changed files with 698 additions and 925 deletions

View file

@ -103,32 +103,6 @@ class ServiceController extends Controller
return redirect()->route('admin.services.new')->withInput();
}
/**
* Delete a service from the system.
*
* @param Request $request
* @param int $id
* @return \Illuminate\Response\RedirectResponse
*/
public function delete(Request $request, $id)
{
$repo = new ServiceRepository;
try {
$repo->delete($id);
Alert::success('Successfully deleted service.')->flash();
return redirect()->route('admin.services');
} catch (DisplayException $ex) {
Alert::danger($ex->getMessage())->flash();
} catch (\Exception $ex) {
Log::error($ex);
Alert::danger('An error was encountered while attempting to delete that service. This error has been logged')->flash();
}
return redirect()->route('admin.services.view', $id);
}
/**
* Edits configuration for a specific service.
*
@ -141,10 +115,17 @@ class ServiceController extends Controller
$repo = new ServiceRepository;
try {
$repo->update($id, $request->intersect([
'name', 'description', 'folder', 'startup',
]));
Alert::success('Service has been updated successfully.')->flash();
if ($request->input('action') !== 'delete') {
$repo->update($id, $request->intersect([
'name', 'description', 'folder', 'startup',
]));
Alert::success('Service has been updated successfully.')->flash();
} else {
$repo->delete($id);
Alert::success('Successfully deleted service from the system.')->flash();
return redirect()->route('admin.services');
}
} catch (DisplayValidationException $ex) {
return redirect()->route('admin.services.view', $id)->withErrors(json_decode($ex->getMessage()))->withInput();
} catch (DisplayException $ex) {