Skip to content

Instantly share code, notes, and snippets.

@clone1018
Created March 16, 2014 15:35
Show Gist options
  • Save clone1018/9584998 to your computer and use it in GitHub Desktop.
Save clone1018/9584998 to your computer and use it in GitHub Desktop.
<?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