lasthourcloud/app/Http/Livewire/Project/Shared/EnvironmentVariable/Show.php
Andras Bacsai a378b5108e refactor a lot of things
fix: postgres_passwords could be longer
feat: able to define postgresql databases from the ui
2023-08-09 15:57:53 +02:00

44 lines
1.0 KiB
PHP

<?php
namespace App\Http\Livewire\Project\Shared\EnvironmentVariable;
use App\Models\EnvironmentVariable as ModelsEnvironmentVariable;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class Show extends Component
{
public $parameters;
public ModelsEnvironmentVariable $env;
public string|null $modalId = null;
protected $rules = [
'env.key' => 'required|string',
'env.value' => 'required|string',
'env.is_build_time' => 'required|boolean',
];
protected $validationAttributes = [
'key' => 'key',
'value' => 'value',
'is_build_time' => 'build',
];
public function mount()
{
$this->modalId = new Cuid2(7);
$this->parameters = get_route_parameters();
}
public function submit()
{
$this->validate();
$this->env->save();
$this->emit('success', 'Environment variable updated successfully.');
}
public function delete()
{
$this->env->delete();
$this->emit('refreshEnvs');
}
}