Created
March 16, 2014 15:35
-
-
Save clone1018/9584998 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function isMember(Project $project) | |
{ | |
if($project->owner instanceof Organization) { | |
foreach($project->owner->users() as $user) { | |
if($user->id === $this->id) { | |
return true; | |
} | |
} | |
} elseif($project->owner instanceof User) { | |
if($project->owner->id === $this->id) { | |
return true; | |
} | |
} else { | |
throw new Exception("Project doesn't have an owner."); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment