An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
<?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',
'team-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');
}
}