public function addComment($data) { if ($data) { $user_image_id = (int) ImageFacade::findIdUserOfImage($data['image_id']); if ($user_image_id !== (int) $data['user_id']) { $notiCreate = ['user_from_id' => $data['user_id'], 'user_to_id' => $user_image_id, 'kind' => 'comment', 'seen' => 0]; $noti = NoticationFacade::createNotication($notiCreate); } if (isset($noti)) { $data['noti_id'] = $noti['id']; } else { $data['noti_id'] = null; } $comment = CommentFacade::addComment($data); return $comment; } }