2023-05-05 07:28:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire\Project\Application\EnvironmentVariable;
|
|
|
|
|
|
|
|
use App\Models\Application;
|
2023-05-05 12:20:10 +00:00
|
|
|
use App\Models\EnvironmentVariable;
|
2023-05-05 07:28:00 +00:00
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class All extends Component
|
|
|
|
{
|
|
|
|
public Application $application;
|
2023-05-05 12:20:10 +00:00
|
|
|
protected $listeners = ['refreshEnvs', 'submit'];
|
2023-05-05 07:28:00 +00:00
|
|
|
public function refreshEnvs()
|
|
|
|
{
|
|
|
|
$this->application->refresh();
|
|
|
|
}
|
2023-05-05 12:20:10 +00:00
|
|
|
public function submit($data)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
EnvironmentVariable::create([
|
|
|
|
'key' => $data['key'],
|
|
|
|
'value' => $data['value'],
|
|
|
|
'is_build_time' => $data['is_build_time'],
|
|
|
|
'application_id' => $this->application->id,
|
|
|
|
]);
|
|
|
|
$this->application->refresh();
|
|
|
|
$this->emit('clearAddEnv');
|
|
|
|
} catch (\Exception $e) {
|
2023-05-09 09:33:50 +00:00
|
|
|
return generalErrorHandler($e, $this);
|
2023-05-05 12:20:10 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-05 07:28:00 +00:00
|
|
|
}
|