Skip to content

Instantly share code, notes, and snippets.

@mass6
Last active October 17, 2017 08:52
Show Gist options
  • Save mass6/9c0b48d0c5c422927873c1c92a5c788e to your computer and use it in GitHub Desktop.
Save mass6/9c0b48d0c5c422927873c1c92a5c788e to your computer and use it in GitHub Desktop.
public function getModelRepresentation()
{
switch ($this) {
case instance of Mention:
if ($this->mentionable instanceof Comment) {
return $this->mentionable->commentable;
}
return $this->mentionable;
break;
case instance of Comment:
return $this->commentable;
break;
case instance of Like:
return $this->likeable;
break;
default:
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment