An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
refactor
Andras Bacsai662b191dfdac
diff --git a/app/Http/Controllers/DatabaseController.php b/app/Http/Controllers/DatabaseController.phpindex 4c02c8bc2f..bddc7ffe6c 100644--- a/app/Http/Controllers/DatabaseController.php+++ b/app/Http/Controllers/DatabaseController.php@@ -26,7 +26,7 @@ class DatabaseController extends Controllerreturn view('project.database.configuration', ['database' => $database]);}- public function backup_logs()+ public function executions(){$backup_uuid = request()->route('backup_uuid');$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();@@ -45,8 +45,8 @@ class DatabaseController extends Controllerif (!$backup) {return redirect()->route('dashboard');}- $backup_executions = collect($backup->executions)->sortByDesc('created_at');- return view('project.database.backups.logs', ['database' => $database, 'backup' => $backup, 'backup_executions' => $backup_executions]);+ $executions = collect($backup->executions)->sortByDesc('created_at');+ return view('project.database.backups.executions', ['database' => $database, 'backup' => $backup, 'executions' => $executions]);}public function backups()diff --git a/app/Http/Livewire/Project/Database/BackupExecutions.php b/app/Http/Livewire/Project/Database/BackupExecutions.phpindex a4d034ab96..93da317f71 100644--- a/app/Http/Livewire/Project/Database/BackupExecutions.php+++ b/app/Http/Livewire/Project/Database/BackupExecutions.php@@ -12,6 +12,6 @@ class BackupExecutions extends Componentpublic function refreshBackupExecutions(): void{- $this->executions = collect($this->backup->executions)->sortByDesc('created_at');+ $this->executions = $this->backup->executions;}}diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.phpindex c2c443d36b..644b5978ce 100644--- a/app/Jobs/DatabaseBackupJob.php+++ b/app/Jobs/DatabaseBackupJob.php@@ -105,7 +105,7 @@ class DatabaseBackupJob implements ShouldQueue$this->backup_status = 'failed';$this->add_to_backup_output($th->getMessage());ray('Backup failed for ' . $this->database->uuid . ' at ' . $this->server->name . ':' . $this->backup_filename . '\n\nError:' . $th->getMessage());- $this->team->notify(new BackupFailed($this->backup, $this->database));+ $this->team->notify(new BackupFailed($this->backup, $this->database, $this->backup_output));} finally {$this->backup_log->update(['status' => $this->backup_status,diff --git a/app/Notifications/Database/BackupFailed.php b/app/Notifications/Database/BackupFailed.phpindex 839ec0da91..b47f03291a 100644--- a/app/Notifications/Database/BackupFailed.php+++ b/app/Notifications/Database/BackupFailed.php@@ -17,9 +17,9 @@ class BackupFailed extends Notification implements ShouldQueuepublic string $message = 'Backup FAILED';- public function __construct(ScheduledDatabaseBackup $backup, public $database)+ public function __construct(ScheduledDatabaseBackup $backup, public $database, public $output){- $this->message = "❌ Database backup for {$database->name} with frequency of $backup->frequency was FAILED.";+ $this->message = "❌ Database backup for {$database->name} with frequency of $backup->frequency was FAILED.\n\nReason: $output";}public function via(object $notifiable): arraydiff --git a/resources/views/livewire/project/database/backup-executions.blade.php b/resources/views/livewire/project/database/backup-executions.blade.phpindex 1342b3997b..0b7c093973 100644--- a/resources/views/livewire/project/database/backup-executions.blade.php+++ b/resources/views/livewire/project/database/backup-executions.blade.php@@ -1,10 +1,11 @@-<div class="flex flex-col gap-2">+<div class="flex flex-col gap-2 flex-col-reverse">@forelse($executions as $execution)<form class="border-1 bg-coolgray-300 p-2 border-dotted flex flex-col"@class(['border-green-500' => data_get($execution,'status') === 'success','border-red-500' => data_get($execution,'status') === 'failed',])>+ <div>Started At: {{data_get($execution,'created_at')}}</div><div>Status: {{data_get($execution,'status')}}</div>@if(data_get($execution,'message'))<div>Message: {{data_get($execution,'message')}}</div>@@ -18,5 +19,4 @@@empty<div>No executions found.</div>@endforelse-</div>diff --git a/resources/views/project/database/backups/logs.blade.php b/resources/views/project/database/backups/executions.blade.phpsimilarity index 94%rename from resources/views/project/database/backups/logs.blade.phprename to resources/views/project/database/backups/executions.blade.phpindex 9f49f80496..78f1178c8b 100644--- a/resources/views/project/database/backups/logs.blade.php+++ b/resources/views/project/database/backups/executions.blade.php@@ -14,6 +14,6 @@<div class="pt-6"><livewire:project.database.backup-edit :backup="$backup"/><h3 class="py-4">Executions</h3>- <livewire:project.database.backup-executions :backup="$backup" :executions="$backup_executions"/>+ <livewire:project.database.backup-executions :backup="$backup" :executions="$executions"/></div></x-layout>diff --git a/routes/web.php b/routes/web.phpindex 3fc2e34508..cf56512500 100644--- a/routes/web.php+++ b/routes/web.php@@ -64,7 +64,7 @@ Route::middleware(['auth'])->group(function () {// DatabasesRoute::get('/project/{project_uuid}/{environment_name}/database/{database_uuid}', [DatabaseController::class, 'configuration'])->name('project.database.configuration');Route::get('/project/{project_uuid}/{environment_name}/database/{database_uuid}/backups', [DatabaseController::class, 'backups'])->name('project.database.backups.all');- Route::get('/project/{project_uuid}/{environment_name}/database/{database_uuid}/backups/{backup_uuid}', [DatabaseController::class, 'backup_logs'])->name('project.database.backups.logs');+ Route::get('/project/{project_uuid}/{environment_name}/database/{database_uuid}/backups/{backup_uuid}', [DatabaseController::class, 'executions'])->name('project.database.backups.executions');});Route::middleware(['auth'])->group(function () {