Ejemplo n.º 1
0
 /**
  * @param CreateRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postCompose(CreateRequest $request)
 {
     try {
         $conversation = $this->conversationRepository->create(['title' => $request->input('title'), 'message' => $request->input('message'), 'participants' => $request->getUseridArray('participants')]);
     } catch (ConversationCantSendToSelfException $exception) {
         return redirect()->route('conversations.compose')->withInput()->withErrors(['participants' => $exception->getMessage()]);
     }
     if ($conversation) {
         return redirect()->route('conversations.read', ['id' => $conversation->id]);
     }
     return redirect()->route('conversations.compose')->withInput()->withErrors(['content' => 'error']);
 }