coolify/app/Livewire/Project/Database/Backup/Execution.php
Andras Bacsai d7385ad0c4 feat(backups): support scheduled backups for application storage targets
Add polymorphic volume backup scheduling for persistent volumes and directories, expose schedule management via API, and reorganize backup configuration and execution views.
2026-07-15 17:34:22 +02:00

60 lines
2 KiB
PHP

<?php
namespace App\Livewire\Project\Database\Backup;
use App\Models\ScheduledDatabaseBackup;
use Livewire\Component;
class Execution extends Component
{
public $database;
public ?ScheduledDatabaseBackup $backup;
public $executions;
public $s3s;
public array $parameters = [];
public string $section = 'general';
public function mount()
{
$backup_uuid = request()->route('backup_uuid');
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (! $project) {
return redirect()->route('dashboard');
}
$environment = $project->load(['environments'])->environments->where('uuid', request()->route('environment_uuid'))->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');
}
$backup = $database->scheduledBackups->where('uuid', $backup_uuid)->first();
if (! $backup) {
return redirect()->route('dashboard');
}
$executions = collect($backup->executions)->sortByDesc('created_at');
$this->database = $database;
$this->backup = $backup;
$this->executions = $executions;
$this->s3s = currentTeam()->s3s;
$this->parameters = get_route_parameters();
$this->section = match (request()->route()?->getName()) {
'project.database.backup.s3' => 's3',
'project.database.backup.retention' => 'retention',
'project.database.backup.executions' => 'executions',
'project.database.backup.danger' => 'danger',
default => 'general',
};
}
public function render()
{
return view('livewire.project.database.backup.execution');
}
}