lasthourcloud/app/Http/Livewire/Project/Application/Storages/Add.php

44 lines
1.0 KiB
PHP
Raw Normal View History

2023-05-05 10:08:38 +00:00
<?php
namespace App\Http\Livewire\Project\Application\Storages;
use App\Models\Application;
use App\Models\LocalPersistentVolume;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Route;
use Livewire\Component;
class Add extends Component
{
public $parameters;
public string $name;
public string $mount_path;
public string|null $host_path = null;
2023-05-05 12:20:10 +00:00
protected $listeners = ['clearAddStorage' => 'clear'];
2023-05-05 10:08:38 +00:00
protected $rules = [
'name' => 'required|string',
'mount_path' => 'required|string',
'host_path' => 'string|nullable',
];
public function mount()
{
2023-05-08 11:36:49 +00:00
$this->parameters = getParameters();
2023-05-05 10:08:38 +00:00
}
public function submit()
{
$this->validate();
2023-05-05 12:20:10 +00:00
$this->emitUp('submit', [
'name' => $this->name,
'mount_path' => $this->mount_path,
'host_path' => $this->host_path,
]);
}
public function clear()
{
$this->name = '';
$this->mount_path = '';
$this->host_path = null;
2023-05-05 10:08:38 +00:00
}
}