/**
  * Remove the specified resource from storage.
  *
  * @param Request $request
  * @param  int    $id
  *
  * @return Response
  */
 public function destroy(Request $request, $id)
 {
     if ($this->post->delete($id)) {
         return redirect()->route('post.index', getQueryParams($request->fullUrl()))->with('success', 'Post successfully deleted!');
     }
     return redirect('post')->with('error', 'Error deleting Post !');
 }
 /**
  * @return array
  */
 public function getContentOptions()
 {
     $contentOptions = [];
     $posts = $this->postService->getAllPosts();
     foreach ($posts as $post) {
         $contentOptions[$post->id] = $post->metadata->title;
     }
     return $contentOptions;
 }
 /**
  * increase share count
  *
  * @param $postId
  *
  * @return \Illuminate\Contracts\Routing\ResponseFactory|mixed
  */
 public function share($postId)
 {
     if (!$this->post->find($postId)) {
         return $this->response->errorWrongArgs();
     }
     if ($post = $this->post->increaseShareCount($postId, 1)) {
         return $this->response->withArray(['status' => 'success']);
     }
     return $this->response->errorInternalError();
 }
 /**
  * gets deleted posts,question,answers
  * @param  array $filter
  * @return array|bool
  */
 public function deleted($filter = [])
 {
     try {
         if (isset($filter['last_updated'])) {
             $filter['deleted_at'] = \Carbon::createFromTimestamp($filter['last_updated'])->toDateTimeString();
         }
         $data['posts'] = $this->post->deleted($filter);
         $data['categories'] = $this->category->deleted($filter);
         return $data;
     } catch (\Exception $e) {
         $this->logger->error($e);
         return false;
     }
     return false;
 }