@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Core\Container; |
| 7 | 7 | use Core\Constant; |
| 8 | 8 | |
| 9 | -class CommentModel extends Model{ |
|
| 9 | +class CommentModel extends Model { |
|
| 10 | 10 | |
| 11 | 11 | private $commentTbl; |
| 12 | 12 | private $userTbl; |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | * @return int |
| 137 | 137 | * @throws \Exception |
| 138 | 138 | */ |
| 139 | - public function addComment(int $postId, int $userId, string $message, bool $admin=false):int |
|
| 139 | + public function addComment(int $postId, int $userId, string $message, bool $admin = false):int |
|
| 140 | 140 | { |
| 141 | - $sql=" |
|
| 141 | + $sql = " |
|
| 142 | 142 | INSERT INTO $this->commentTbl (users_idusers, posts_idposts, comment, approved) |
| 143 | 143 | VALUES (:userId, :postId, :comment, :approved) |
| 144 | 144 | "; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $this->bind(':approved', $admin); |
| 150 | 150 | |
| 151 | 151 | $this->execute(); |
| 152 | - return (int)$this->dbh->lastInsertId(); |
|
| 152 | + return (int) $this->dbh->lastInsertId(); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | $postId = $this->request->getData("postId"); |
| 89 | 89 | |
| 90 | 90 | //check if we are admin, Admins do not need moderation |
| 91 | - $admin = $this->session->get('user_role_level')>= Constant::ADMIN_LEVEL; |
|
| 91 | + $admin = $this->session->get('user_role_level') >= Constant::ADMIN_LEVEL; |
|
| 92 | 92 | |
| 93 | 93 | $this->commentModel->addComment($postId, $userId, $comment, $admin); |
| 94 | 94 | |