Change to how we resolve a user's team between Slack/ and App/* models
This commit is contained in:
parent
c5a13046ed
commit
1c3966598d
@ -21,6 +21,11 @@ class User extends Model
|
||||
return $this->belongsTo(Enterprise::class);
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo(Team::class);
|
||||
}
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
/**
|
||||
@ -49,10 +54,10 @@ class User extends Model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTeamAttribute(): ?Team
|
||||
public function getUserTeamAttribute(): ?Team
|
||||
{
|
||||
Log::debug(sprintf('%s:User [%s]',self::LOGKEY,$this->id),['team'=>$this->team_id,'enterprise'=>$this->enterprise_id,'eo'=>$this->enterprise]);
|
||||
|
||||
return $this->team_id ? Team::find($this->team_id) : (($x=$this->enterprise->teams) ? $x->first() : NULL);
|
||||
return $this->team_id ? $this->team : (($x=$this->enterprise->teams) ? $x->first() : NULL);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user