diff --git a/src/Http/Controllers/SlackAppController.php b/src/Http/Controllers/SlackAppController.php index 81ea380..67b0d67 100644 --- a/src/Http/Controllers/SlackAppController.php +++ b/src/Http/Controllers/SlackAppController.php @@ -54,6 +54,7 @@ class SlackAppController extends Controller * Install this Slack Application. * * @param Request $request + * @param bool $oauth * @return string * @throws \GuzzleHttp\Exception\GuzzleException */ diff --git a/src/Models/Channel.php b/src/Models/Channel.php index f265b39..d5bd22d 100644 --- a/src/Models/Channel.php +++ b/src/Models/Channel.php @@ -13,6 +13,7 @@ class Channel extends Model use ScopeActive; protected $fillable = ['team_id','channel_id','name','active']; + protected $table = 'slack_channels'; /* RELATIONS */ diff --git a/src/Models/Enterprise.php b/src/Models/Enterprise.php index 94325dd..afedaa0 100644 --- a/src/Models/Enterprise.php +++ b/src/Models/Enterprise.php @@ -12,6 +12,7 @@ class Enterprise extends Model use ScopeActive; protected $fillable = ['enterprise_id']; + protected $table = 'slack_enterprises'; /* RELATIONS */ diff --git a/src/Models/Team.php b/src/Models/Team.php index b799ba5..8bc08e9 100644 --- a/src/Models/Team.php +++ b/src/Models/Team.php @@ -15,6 +15,7 @@ class Team extends Model use ScopeActive; protected $fillable = ['team_id']; + protected $table = 'slack_teams'; /* RELATIONS */ diff --git a/src/Models/Token.php b/src/Models/Token.php index 111f499..e553633 100644 --- a/src/Models/Token.php +++ b/src/Models/Token.php @@ -12,6 +12,8 @@ class Token extends Model { use ScopeActive; + protected $table = 'slack_tokens'; + /* RELATIONS */ public function team() diff --git a/src/Models/User.php b/src/Models/User.php index aa8542b..6210501 100644 --- a/src/Models/User.php +++ b/src/Models/User.php @@ -17,6 +17,7 @@ class User extends Model protected const LOGKEY = '-MU'; protected $fillable = ['user_id']; + protected $table = 'slack_users'; /* RELATIONS */ @@ -52,15 +53,15 @@ class User extends Model /** * Return the team that this user is in - normally required to get the team token - * For enterprise users, any team token will do. + * For enterprise users, any team token will do, so we choose the first team of the enteprise * * If the integration is not installed in any channels, team will be blank * - * @return mixed + * @return Team|null */ 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]); + Log::debug(sprintf('%s:User [%s], Team [%s], Enterprise [%s]',self::LOGKEY,$this->id,$this->team_id,$this->enterprise_id),['m'=>__METHOD__]); return $this->team_id ? $this->team : (($x=$this->enterprise->teams) ? $x->first() : NULL); }