public function destroy($id)
 {
     $blog = Blog::find($id);
     if ($blog && FEUsersHelper::isCurrentUser($blog->user->id)) {
         FELikesHelper::delete($blog->getEntry()->id);
         FEEntriesHelper::delete($blog->id, 2);
         $blog->delete();
         return Redirect::to('blog?user_id=' . $blog->user->id);
     }
     return Redirect::to('/');
 }
 public function destroy($id)
 {
     $post = Post::find($id);
     if ($post && FEUsersHelper::isCurrentUser($post->user->id)) {
         FELikesHelper::delete($post->getEntry()->id);
         FEEntriesHelper::delete($post->id, 1);
         $post->delete();
         echo 'true';
     } else {
         echo 'false';
     }
 }
 public function destroy($id)
 {
     $album = Album::find($id);
     if (FEUsersHelper::isCurrentUser($album->user->id)) {
         $user_id = $album->user_id;
         foreach ($album->images as $image) {
             $image->delete();
         }
         FELikesHelper::delete($album->getEntry()->id);
         FEEntriesHelper::delete($album->id, 3);
         $album->delete();
         return Redirect::to('album?user_id=' . $user_id);
     } else {
         return Redirect::to('/');
     }
 }
 public function store()
 {
     $entry_id = Input::get('entry_id');
     $user_id = Session::get('user')['id'];
     $like_id = FELikesHelper::getId($entry_id, $user_id, false);
     if ($like_id) {
         $like = Like::find($like_id);
         $like->is_deleted = 0;
         $like->save();
         $result = $like->toArray();
         $result['status'] = 'success';
         echo json_encode($result);
     } else {
         $like = new Like();
         $like->entry_id = $entry_id;
         $like['user_id'] = $user_id;
         $like->is_deleted = 0;
         $like->save();
         $result = $like->toArray();
         $result['status'] = 'success';
         echo json_encode($result);
     }
 }