lasthourcloud/app/Livewire/Settings/Index.php

43 lines
1.0 KiB
PHP
Raw Normal View History

2024-01-07 15:23:41 +00:00
<?php
namespace App\Livewire\Settings;
use App\Models\InstanceSettings;
use App\Models\S3Storage;
use App\Models\StandalonePostgresql;
use Livewire\Component;
class Index extends Component
{
public InstanceSettings $settings;
2024-06-10 20:43:34 +00:00
2024-01-07 15:23:41 +00:00
public StandalonePostgresql $database;
2024-06-10 20:43:34 +00:00
2024-01-07 15:23:41 +00:00
public $s3s;
2024-06-10 20:43:34 +00:00
2024-01-07 15:23:41 +00:00
public function mount()
{
if (isInstanceAdmin()) {
2024-07-12 13:45:36 +00:00
$settings = \App\Models\InstanceSettings::get();
2024-01-07 15:23:41 +00:00
$database = StandalonePostgresql::whereName('coolify-db')->first();
2024-01-09 13:27:42 +00:00
$s3s = S3Storage::whereTeamId(0)->get() ?? [];
2024-01-07 15:23:41 +00:00
if ($database) {
if ($database->status !== 'running') {
$database->status = 'running';
$database->save();
}
2024-01-09 13:27:42 +00:00
$this->database = $database;
2024-01-07 15:23:41 +00:00
}
$this->settings = $settings;
2024-01-09 13:27:42 +00:00
$this->s3s = $s3s;
2024-01-07 15:23:41 +00:00
} else {
return redirect()->route('dashboard');
}
}
2024-06-10 20:43:34 +00:00
2024-01-07 15:23:41 +00:00
public function render()
{
return view('livewire.settings.index');
}
}