Group backup schedules by their parent database (type + ID) for better organization in the UI. Filter to only display backups with save_s3 enabled. Restructure the template to show database name as a header with nested backups underneath, allowing clearer visualization of which backups belong to each database. Add key binding to livewire component to ensure proper re-rendering when resources change.
25 lines
612 B
PHP
25 lines
612 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Storage;
|
|
|
|
use App\Models\S3Storage;
|
|
use App\Models\ScheduledDatabaseBackup;
|
|
use Livewire\Component;
|
|
|
|
class Resources extends Component
|
|
{
|
|
public S3Storage $storage;
|
|
|
|
public function render()
|
|
{
|
|
$backups = ScheduledDatabaseBackup::where('s3_storage_id', $this->storage->id)
|
|
->where('save_s3', true)
|
|
->with('database')
|
|
->get()
|
|
->groupBy(fn ($backup) => $backup->database_type.'-'.$backup->database_id);
|
|
|
|
return view('livewire.storage.resources', [
|
|
'groupedBackups' => $backups,
|
|
]);
|
|
}
|
|
}
|