@@ 561-575 (lines=15) @@ | ||
558 | * @param int $id |
|
559 | * @return \Illuminate\Http\RedirectResponse |
|
560 | */ |
|
561 | public function resetDatabasePassword(Request $request, $id) |
|
562 | { |
|
563 | $database = Models\Database::where('server_id', $id)->findOrFail($request->input('database')); |
|
564 | $repo = new DatabaseRepository; |
|
565 | ||
566 | try { |
|
567 | $repo->password($database->id, str_random(20)); |
|
568 | ||
569 | return response('', 204); |
|
570 | } catch (\Exception $ex) { |
|
571 | Log::error($ex); |
|
572 | ||
573 | return response()->json(['error' => 'A unhandled exception occurred while attempting to reset this password. This error has been logged.'], 503); |
|
574 | } |
|
575 | } |
|
576 | ||
577 | /** |
|
578 | * Deletes a database from a server. |
|
@@ 585-599 (lines=15) @@ | ||
582 | * @param int $database |
|
583 | * @return \Illuminate\Http\RedirectResponse |
|
584 | */ |
|
585 | public function deleteDatabase(Request $request, $id, $database) |
|
586 | { |
|
587 | $database = Models\Database::where('server_id', $id)->findOrFail($database); |
|
588 | $repo = new DatabaseRepository; |
|
589 | ||
590 | try { |
|
591 | $repo->drop($database->id); |
|
592 | ||
593 | return response('', 204); |
|
594 | } catch (\Exception $ex) { |
|
595 | Log::error($ex); |
|
596 | ||
597 | return response()->json(['error' => 'A unhandled exception occurred while attempting to drop this database. This error has been logged.'], 503); |
|
598 | } |
|
599 | } |
|
600 | } |
|
601 |