diff --git a/app/Models/User.php b/app/Models/User.php index 51ac0aa14..970120079 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -118,6 +118,9 @@ class User extends Authenticatable implements SendsEmail public function currentTeam() { return Cache::remember('team:' . auth()->user()->id, 3600, function () { + if (is_null(data_get(session('currentTeam'), 'id'))) { + return auth()->user()->teams[0]; + } return Team::find(session('currentTeam')->id); }); }