/**
  * Get the name of an innovation
  * @param $id
  * @return mixed
  */
 public function getInnovationName($id)
 {
     return Innovation::where('id', $id)->first()->innovationTitle;
 }
 /**
  * Persists a message to the database
  * @param MessagesCreateRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(MessagesCreateRequest $request)
 {
     $input = $request;
     $innovation = Innovation::findOrFail($input['innovation_id']);
     $thread = Thread::create(['subject' => $input['subject'], 'innovation_id' => $input['innovation_id'], 'user_id' => \Auth::user()->id, 'receiver_id' => $innovation->user_id, 'unique_id' => str_random(30)]);
     $this->addReceiver($thread, $input['recipients']);
     // Message
     $message = Message::create(['thread_id' => $thread->id, 'user_id' => Auth::user()->id, 'body' => $input['message'], 'starter_id' => \Auth::user()->id, 'innovation_id' => $input['innovation_id']]);
     if (Input::has('progress')) {
         Progress::create(['innovation_id' => $input['innovation_id'], 'investor_id' => Auth::user()->id, 'progress_status' => 1]);
     }
     // Sender
     Participant::create(['thread_id' => $thread->id, 'user_id' => Auth::user()->id, 'last_read' => new Carbon()]);
     // Recipients
     if (Input::has('recipients')) {
         $thread->addParticipants($input['recipients']);
     }
     $this->oooPushIt($message);
     return redirect('innovation/' . $innovation->id . '#messages');
 }