46 lines
1.8 KiB
PHP
46 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
|
|
class DatabaseController extends Controller
|
|
{
|
|
use AuthorizesRequests, ValidatesRequests;
|
|
|
|
public function configuration()
|
|
{
|
|
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
|
if (!$project) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
|
if (!$environment) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
$database = $environment->databases->where('uuid', request()->route('database_uuid'))->first();
|
|
if (!$database) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
return view('project.database.configuration', ['database' => $database]);
|
|
}
|
|
|
|
public function backups()
|
|
{
|
|
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
|
if (!$project) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
|
if (!$environment) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
$database = $environment->databases->where('uuid', request()->route('database_uuid'))->first();
|
|
if (!$database) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
return view('project.database.backups', ['database' => $database]);
|
|
}
|
|
}
|