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

43 lines
1.1 KiB
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 Livewire\Component;
class Application extends Component
{
public ServiceApplication $application;
public $fileStorages = null;
protected $listeners = ["refreshFileStorages"];
2023-09-22 09:23:49 +00:00
protected $rules = [
'application.human_name' => 'nullable',
'application.description' => 'nullable',
2023-09-22 09:23:49 +00:00
'application.fqdn' => 'nullable',
];
public function render()
{
return view('livewire.project.service.application');
}
public function refreshFileStorages()
{
$this->fileStorages = $this->application->fileStorages()->get();
}
public function mount()
{
$this->refreshFileStorages();
}
2023-09-22 09:23:49 +00:00
public function submit()
{
try {
$this->validate();
$this->application->save();
$this->emit('success', 'Application saved successfully.');
2023-09-22 09:23:49 +00:00
} catch (\Throwable $e) {
ray($e);
} finally {
$this->emit('generateDockerCompose');
}
}
}