lorsque j'écris cette requête. J'ai un deux enregistrements dans le résultat bien que la table n'en a qu'un.laravel: requête obtenir des enregistrements en double laravel
$side_messages = Message::orderBy('id' , 'desc')->where('to_id' , Auth::id())->orWhere('from_id' , Auth::id())->first();
dd($side_messages);
le résultat: objet (Message) # 412 (20) {[ "remplissable": protected] => array (4) {[0] => string (5) "to_id" [1] => string (7) "from_id" [2] => chaîne (3) "msg" [3] => chaîne (4) "vu"} ["guarded": protected] => array (0) {} [ "connection": protected] => NULL ["table": protégée] => NULL ["primaryKey": protégée] => chaîne (2) "id" ["perPage": protected] => int (15) [" incrementing "] => bool (true) [" timestamps "] => bool (true) [" attributs ": protected] => array (7) {[" id "] => chaîne (1)" 1 "[" from_id "] => string (1)" 1 "[" to_id "] => chaîne (1)" 2 "[" msg "] => chaîne (18)" test_query "[" seen "] => string (1) "0" ["created_at"] => chaîne (19) "0000-00-00 00:00:00" ["updated_at"] => chaîne (19) "0000-00-00 00:00:00" } ["original": protected] => array (7) {["id"] => string (1) "1" ["from_id"] => chaîne (1) "1" ["to_id"] => chaîne (1) "2" ["msg"] => chaîne (18) "test_query" ["seen"] => string (1) "0" [" created_at "] => chaîne (19)" 0000-00-00 00:00:00 "[" updated_at "] => chaîne (19)" 0000-00-00 00:00:00 "} [" relations ": protected] => array (0) {} ["hidden": protected] => array (0) {} ["visible": protected] => array (0) {} ["ajoute": protected] => tableau (0) {} ["dates": protected] => array (0) {} ["touches": protected] => array (0) {} ["observables": protected] => array (0) {} ["with": protected] => array (0) {} ["morphClass": protected] => NULL ["exists"] => bool (true)}
Cela ressemble à un objet pour moi. –