/**
  * Add summary to case
  *
  * @param Request $request
  * @param integer  $caseId
  *
  * @return view
  */
 public function addSummary(Request $request, $caseId)
 {
     $summary = new Summary();
     $summary->case_id = $caseId;
     $summary->user_id = Auth::user()->id;
     $summary->summary = $request->input('summary');
     $summary->save();
     $case = $this->case->find($caseId);
     $this->case->openCase($case);
     Session::flash('flash_success', trans('crm-launcher::success.summary_added'));
     return back();
 }
 /**
  * Links case to user (person who replied)
  *
  * @param object $case
  *
  * @return void
  */
 private function linkCaseToUser($case)
 {
     $case = $this->case->find($case->id);
     if (!$case->users->contains(Auth::user()->id)) {
         $case->users()->attach(Auth::user()->id);
     }
 }
 /**
  * Update case with newest Facebook or Tweet id
  * @param  integer $caseId
  * @param  integer $messageId
  * @param  string $type
  * @return void
  */
 private function updateCase($caseId, $type, $messageId)
 {
     $case = $this->case->find($caseId);
     if ($type == 'twitter') {
         $case->latest_tweet_id = $messageId;
     } else {
         $case->latest_fb_id = $messageId;
     }
     $case->save();
 }