public function store()
    {
        $input = Input::all();

        $thread = Thread::create(
            [
                'subject' => $input['subject'],
            ]
        );

        // Message
        Message::create(
            [
                'thread_id' => $thread->id,
                'user_id'   => Auth::user()->id,
                'body'      => $input['message'],
            ]
        );

        // 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']);
        }

        return redirect('message');
    }
public function store()
    {
        $input = Input::all();

        $thread = Thread::create(
            [
                'subject' => $input['subject'],
            ]
        );

        // Message
        Message::create(
            [
                'thread_id' => $thread->id,
                'user_id'   => Auth::user()->id,
                'body'      => $input['message'],
            ]
        );

        // 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']);
        }

        return redirect('message');
    }
public function store ( ) { $ input = Input :: all ( ) ; $ thread = Thread :: create ( [ 'subject' => $ input [ 'subject' ] , ] ) ; // Message Message :: create ( [ 'thread_id' => $ thread -> id , 'user_id' => Auth :: user ( ) -> id , 'body' => $ input [ 'message' ] , ] ) ; // 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' ] ) ; } return redirect ( 'message' ) ; }
Stores a new message thread

@return mixed
Stores a new message thread