Files
coolify/app/Livewire/SwitchTeam.php
T
6b07f03107 feat(terminal): interactive console mode for containers (docker attach) (#11538)
Co-authored-by: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com>
Co-authored-by: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rosslh <ross@rosshill.ca>
2026-10-14 14:32:02 +02:00

38 lines
796 B
PHP

<?php
namespace App\Livewire;
use App\Models\Team;
use Livewire\Component;
class SwitchTeam extends Component
{
public string $selectedTeamId = 'default';
protected $listeners = ['team-avatar-updated' => '$refresh'];
public function mount()
{
$this->selectedTeamId = auth()->user()->currentTeam()->id;
}
public function updatedSelectedTeamId()
{
$this->switch_to($this->selectedTeamId);
}
public function switch_to($team_id)
{
if (! auth()->user()->teams->contains($team_id)) {
return;
}
$team_to_switch_to = Team::find($team_id);
if (! $team_to_switch_to) {
return;
}
refreshSession($team_to_switch_to);
return redirect()->route('dashboard');
}
}