2025-11-25 14:22:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Livewire\Project\Shared\EnvironmentVariable;
|
|
|
|
|
|
2026-08-18 17:13:23 +00:00
|
|
|
use App\Models\EnvironmentVariable;
|
2025-11-25 14:22:38 +00:00
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
|
|
class ShowHardcoded extends Component
|
|
|
|
|
{
|
2026-08-05 11:50:11 +00:00
|
|
|
public bool $showEnvironmentType = true;
|
|
|
|
|
|
2025-11-25 14:22:38 +00:00
|
|
|
public array $env;
|
|
|
|
|
|
|
|
|
|
public string $key;
|
|
|
|
|
|
|
|
|
|
public ?string $value = null;
|
|
|
|
|
|
|
|
|
|
public ?string $comment = null;
|
|
|
|
|
|
|
|
|
|
public ?string $serviceName = null;
|
|
|
|
|
|
2026-08-03 21:11:54 +00:00
|
|
|
public bool $isPreview = false;
|
|
|
|
|
|
2026-08-18 17:13:23 +00:00
|
|
|
public ?string $resourceableType = null;
|
|
|
|
|
|
|
|
|
|
public ?int $resourceableId = null;
|
|
|
|
|
|
2025-11-25 14:22:38 +00:00
|
|
|
public function mount()
|
|
|
|
|
{
|
|
|
|
|
$this->key = $this->env['key'];
|
|
|
|
|
$this->value = $this->env['value'] ?? null;
|
|
|
|
|
$this->comment = $this->env['comment'] ?? null;
|
|
|
|
|
$this->serviceName = $this->env['service_name'] ?? null;
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-18 17:13:23 +00:00
|
|
|
public function copyValue(): ?string
|
|
|
|
|
{
|
|
|
|
|
if (auth()->user()?->isMember() ?? true) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EnvironmentVariable::make([
|
|
|
|
|
'value' => $this->value,
|
|
|
|
|
'is_preview' => $this->isPreview,
|
|
|
|
|
'resourceable_type' => $this->resourceableType,
|
|
|
|
|
'resourceable_id' => $this->resourceableId,
|
|
|
|
|
])->resolveReferencedValue();
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-25 14:22:38 +00:00
|
|
|
public function render()
|
|
|
|
|
{
|
|
|
|
|
return view('livewire.project.shared.environment-variable.show-hardcoded');
|
|
|
|
|
}
|
|
|
|
|
}
|