From 1067f37e4d794d6a3248a6c81960ab25ac12ef2c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 12:03:59 +0200 Subject: [PATCH] fix: deleted team and it is the current one --- app/Models/User.php | 3 +++ 1 file changed, 3 insertions(+) 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); }); }