Last active
April 13, 2017 12:32
-
-
Save craig-davis/d77b084f8618f0ffa34079a5ebaaf9d5 to your computer and use it in GitHub Desktop.
This file contains 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 | |
class Post | |
{ | |
public function canEdit(User $user) : bool | |
{ | |
$canEdit = false; | |
if (($user->getRole() == 3 && $this->getEditorId() == $user->getId()) || $user->getRole() > 5 || ($this->getAuthorId() == $user->getId() && $this->created_at < time() — 2592000)) { | |
$canEdit = true; | |
} | |
return $canEdit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment