Example #1
0
 /**
  * add Like
  */
 public function addLike($data)
 {
     if ($data) {
         $user_id_image = (int) ImageFacade::findIdUserOfImage($data['image_id']);
         if ($user_id_image !== (int) $data['user_id']) {
             $notiInfor = ['user_from_id' => $data['user_id'], 'user_to_id' => $user_id_image, 'kind' => "like", 'seen' => 0];
             $noti = NoticationFacade::createNotication($notiInfor);
         }
         if (isset($noti)) {
             $data['noti_id'] = $noti['id'];
         } else {
             $data['noti_id'] = null;
         }
         $like = LikeFacade::addLike($data);
         return $like;
     }
     return false;
 }