src/lib/Http/Controllers/MessagingController.php
public function postSend(Request $request)
    {
        $message = new Message();

        $message->subject = $request->input('subject');
        $message->body = $request->input('body');
        $message->sent = time();

        if ($request->input('parent_message_id')) {
            $parent = Message::findOrFail($request->input('parent_message_id'));

            $message->parent()->associate($parent);
        }

        $recipient = User::findOrFail($request->input('recipient_user_id'));

        if (Auth::user()->getAcquaintances()->contains($recipient)) {
            // fail
        }

        $message->recipient()->associate($recipient);

        $message->sender()->associate(Auth::user());

        $sent_copy = clone $message;

        $sent_copy->user()->associate(Auth::user());

        $message->user()->associate($recipient);

        $message->save();

        $sent_copy->save();

        return redirect()->back()->withStatus("Message sent to {$recipient->username}.");
    }
public function postSend(Request $request)
    {
        $message = new Message();

        $message->subject = $request->input('subject');
        $message->body = $request->input('body');
        $message->sent = time();

        if ($request->input('parent_message_id')) {
            $parent = Message::findOrFail($request->input('parent_message_id'));

            $message->parent()->associate($parent);
        }

        $recipient = User::findOrFail($request->input('recipient_user_id'));

        if (Auth::user()->getAcquaintances()->contains($recipient)) {
            // fail
        }

        $message->recipient()->associate($recipient);

        $message->sender()->associate(Auth::user());

        $sent_copy = clone $message;

        $sent_copy->user()->associate(Auth::user());

        $message->user()->associate($recipient);

        $message->save();

        $sent_copy->save();

        return redirect()->back()->withStatus("Message sent to {$recipient->username}.");
    }
Send a message.

@param \Illuminate\Http\Request $request

@return \Illuminate\Http\RedirectResponse