app/Http/Controllers/MessagesController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $meeting_id = 0;
        $salon_id = 0;
        if($request['meeting_id']){
            $meeting_id = $request['meeting_id'];
        }
        if($request['salon_id']){
            $salon_id = $request['salon_id'];
        }
        $message = Message::create([
            'meeting_id'        => $meeting_id,
            'salon_id'          => $salon_id,
            'user_id'           => Auth::id(),
            'content_mess'        => $request['content_mess'],
            'date_message'      => now(),
            'statut_mess'       => 0
        ]);
        return response()->json([
            'code'      => 200,
            'message'   => $message
        ]);
    }
public function store ( Request $ request ) { $ meeting_id = 0 ; $ salon_id = 0 ; if ( $ request [ 'meeting_id' ] ) { $ meeting_id = $ request [ 'meeting_id' ] ; } if ( $ request [ 'salon_id' ] ) { $ salon_id = $ request [ 'salon_id' ] ; } $ message = Message :: create ( [ 'meeting_id' => $ meeting_id , 'salon_id' => $ salon_id , 'user_id' => Auth :: id ( ) , 'content_mess' => $ request [ 'content_mess' ] , 'date_message' => now ( ) , 'statut_mess' => 0 ] ) ; return response ( ) -> json ( [ 'code' => 200 , 'message' => $ message ] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .