mardi 2 avril 2019

How to query multiple where in laravel

I have a query that gets all the message between two id (user_id and to_user_id). I want to select all the query all the message of user in the two tables.

I have already made two where and it doesn't seem to work. It is just returning null.

  $last_message = DB::table('messages')
                  ->select('content')
                  ->where('user_id','=',Auth::user()->id)
                  ->where('to_user_id','=',Auth::user()->id)
                  ->orderBy('updated_at', 'desc')
                  ->first();

I expect the output of all the message of user



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2uJTF1i
via IFTTT

Aucun commentaire:

Enregistrer un commentaire