Rubenwouters\CrmLauncher\ApiCalls\FetchTwitterContent::deleteTweetPublishment PHP Method

deleteTweetPublishment() public method

Delete tweet
public deleteTweetPublishment ( object $answer ) : void | Illuminate\View\View
$answer object
return void | Illuminate\View\View
    public function deleteTweetPublishment($answer)
    {
        $client = initTwitter();
        try {
            $client->post('statuses/destroy/' . $answer->tweet_id . '.json');
            Session::flash('flash_success', trans('crm-launcher::success.tweet_deleted'));
        } catch (\GuzzleHttp\Exception\ClientException $e) {
            getErrorMessage($e->getResponse()->getStatusCode());
            return back();
        }
    }

Usage Example

 /**
  * Delete reaction
  *
  * @param  integer $id
  * @return view
  */
 public function deleteReaction($id)
 {
     $reaction = $this->reaction->find($id);
     $reaction->delete();
     if ($reaction->fb_post_id != '') {
         $this->facebookContent->deleteFbPost($reaction);
     }
     if ($reaction->tweet_id != '') {
         $this->twitterContent->deleteTweetPublishment($reaction);
     }
     return back();
 }