From 8e55433d05a3a0fdaa8fa8a82a02d58baeb4ad0c Mon Sep 17 00:00:00 2001 From: Rafael Lunardelli Date: Sun, 13 Sep 2020 01:54:16 -0600 Subject: [PATCH] Fix HasTeams trait to be able to use queries with('currentTeam') --- src/HasTeams.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HasTeams.php b/src/HasTeams.php index e77417c87..1448dea95 100644 --- a/src/HasTeams.php +++ b/src/HasTeams.php @@ -23,7 +23,7 @@ public function isCurrentTeam($team) */ public function currentTeam() { - if (is_null($this->current_team_id)) { + if (is_null($this->current_team_id) && $this->id) { $this->forceFill([ 'current_team_id' => $this->personalTeam()->id, ])->save();