lasthourcloud/app/Http/Livewire/Project/Service/Database.php

38 lines
897 B
PHP
Raw Normal View History

2023-09-22 09:23:49 +00:00
<?php
namespace App\Http\Livewire\Project\Service;
use App\Models\ServiceApplication;
use App\Models\ServiceDatabase;
use Livewire\Component;
class Database extends Component
{
public ServiceDatabase $database;
protected $rules = [
'database.human_name' => 'nullable',
'database.description' => 'nullable',
2023-09-25 13:48:43 +00:00
'database.ignore_from_status' => 'required|boolean',
2023-09-22 09:23:49 +00:00
];
public function render()
{
return view('livewire.project.service.database');
}
2023-09-25 13:48:43 +00:00
public function instantSave() {
$this->submit();
}
2023-09-22 09:23:49 +00:00
public function submit()
{
try {
$this->validate();
$this->database->save();
2023-09-25 13:48:43 +00:00
$this->emit('success', 'Database saved successfully.');
2023-09-22 09:23:49 +00:00
} catch (\Throwable $e) {
ray($e);
} finally {
$this->emit('generateDockerCompose');
}
}
}