Skip to content

Commit

Permalink
Changed isOwnerOfTeam to use $user->team() (#68)
Browse files Browse the repository at this point in the history
* Checked isOwnerOfTeam to use ->team()

* Fixed isOwnerOfTeam return values

* Forgot to ->first() in isOwnerOfTeam()
  • Loading branch information
codedninja authored and mpociot committed Nov 19, 2016
1 parent 010393d commit 0c5e6a4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Mpociot/Teamwork/Traits/UserHasTeams.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,10 @@ protected function retrieveTeamId( $team )
*/
public function isOwnerOfTeam( $team )
{
$team = $this->retrieveTeamId( $team );
$teamModel = Config::get( 'teamwork.team_model' );
$teamKeyName = ( new $teamModel() )->getKeyName();
return ( ( new $teamModel )
->where( "owner_id", "=", $this->getKey() )
->where( $teamKeyName, "=", $team )->first()
$team_id = $this->retrieveTeamId( $team );
return ( $this->teams()
->where('owner_id', $this->getKey())
->where('team_id', $team_id)->first()
) ? true : false;
}

Expand Down

0 comments on commit 0c5e6a4

Please sign in to comment.