2023-05-04 20:29:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire\Project\Application\EnvironmentVariable;
|
|
|
|
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class Add extends Component
|
|
|
|
{
|
|
|
|
public $parameters;
|
2023-06-05 10:07:55 +00:00
|
|
|
public bool $is_preview = false;
|
2023-05-04 20:29:14 +00:00
|
|
|
public string $key;
|
|
|
|
public string $value;
|
|
|
|
public bool $is_build_time = false;
|
|
|
|
|
2023-05-05 12:20:10 +00:00
|
|
|
protected $listeners = ['clearAddEnv' => 'clear'];
|
2023-05-05 07:28:00 +00:00
|
|
|
protected $rules = [
|
|
|
|
'key' => 'required|string',
|
|
|
|
'value' => 'required|string',
|
|
|
|
'is_build_time' => 'required|boolean',
|
|
|
|
];
|
2023-06-16 10:35:40 +00:00
|
|
|
protected $validationAttributes = [
|
|
|
|
'key' => 'key',
|
|
|
|
'value' => 'value',
|
|
|
|
'is_build_time' => 'build',
|
|
|
|
];
|
2023-05-04 20:29:14 +00:00
|
|
|
public function mount()
|
|
|
|
{
|
2023-06-15 07:15:41 +00:00
|
|
|
$this->parameters = getRouteParameters();
|
2023-05-04 20:29:14 +00:00
|
|
|
}
|
|
|
|
public function submit()
|
|
|
|
{
|
2023-07-13 11:16:24 +00:00
|
|
|
ray('submitting');
|
2023-05-05 07:28:00 +00:00
|
|
|
$this->validate();
|
2023-05-05 12:20:10 +00:00
|
|
|
$this->emitUp('submit', [
|
|
|
|
'key' => $this->key,
|
|
|
|
'value' => $this->value,
|
|
|
|
'is_build_time' => $this->is_build_time,
|
2023-06-05 10:07:55 +00:00
|
|
|
'is_preview' => $this->is_preview,
|
2023-05-05 12:20:10 +00:00
|
|
|
]);
|
2023-07-13 11:16:24 +00:00
|
|
|
$this->clear();
|
2023-05-05 12:20:10 +00:00
|
|
|
}
|
|
|
|
public function clear()
|
|
|
|
{
|
|
|
|
$this->key = '';
|
|
|
|
$this->value = '';
|
|
|
|
$this->is_build_time = false;
|
2023-05-04 20:29:14 +00:00
|
|
|
}
|
|
|
|
}
|