refactor routes
This commit is contained in:
38
app/Livewire/Settings/Index.php
Normal file
38
app/Livewire/Settings/Index.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
public StandalonePostgresql $database;
|
||||
public $s3s;
|
||||
public function mount()
|
||||
{
|
||||
if (isInstanceAdmin()) {
|
||||
$settings = InstanceSettings::get();
|
||||
$database = StandalonePostgresql::whereName('coolify-db')->first();
|
||||
if ($database) {
|
||||
if ($database->status !== 'running') {
|
||||
$database->status = 'running';
|
||||
$database->save();
|
||||
}
|
||||
$s3s = S3Storage::whereTeamId(0)->get();
|
||||
}
|
||||
$this->settings = $settings;
|
||||
$this->database = $database;
|
||||
$this->s3s = $s3s ?? [];
|
||||
} else {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.settings.index');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user