/
dimamir
/
coolify
Обзор
Документация
Войти
/
dimamir
/
coolify
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
app/Livewire/SharedVariables/Team/Index.php
44 строки
1 KB
Thijmen
Fix styling
10 июн 2024, 23:43
10 июн 2024, 23:43
d86274c
Код
Авторство
О чём код?
<?php namespace App\Livewire\SharedVariables\Team; use App\Models\Team; use Livewire\Component; class Index extends Component { public Team $team; protected $listeners = ['refreshEnvs' => '$refresh', 'saveKey' => 'saveKey']; public function saveKey($data) { try { $found = $this->team->environment_variables()->where('key', $data['key'])->first(); if ($found) { throw new \Exception('Variable already exists.'); } $this->team->environment_variables()->create([ 'key' => $data['key'], 'value' => $data['value'], 'is_multiline' => $data['is_multiline'], 'is_literal' => $data['is_literal'], 'type' => 'team', 'team_id' => currentTeam()->id, ]); $this->team->refresh(); } catch (\Throwable $e) { return handleError($e, $this); } } public function mount() { $this->team = currentTeam(); } public function render() { return view('livewire.shared-variables.team.index'); } }