I have chat rooms in my laravel project, my table (chat_rooms
) has 2 columns user_id_1
and user_id_2
and my users
table has name
column, I need to execute query with like search on name of user not the user who sent the request but my problem is the column user_id_1
probably is auth user_id_2
column the same. I need to search on name of user not logged in How to write this query.
this is first relation on chat_rooms
model:
public function user_1() { return $this->belongsTo(User::class, 'user_id_1'); }
and this is second relation:
public function user_2() { return $this->belongsTo(User::class, 'user_id_2'); }
Thank you,
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire