php - Checking to see if a conversation already exists Laravel -


hey guys i'm building eloquent query see conversation array of participants exists. reason can't have same conversation same participants created more once.

here's eloquent query:

$convos = conversation::wherehas('participant', function ($query) use ($participantids) {                         $query->wherein('user_id', $participantids)                         ->groupby('convo_id')                         ->havingraw('count(convo_id)='.count($participantids));            })->get(); 

$participantids equal [1, 2] or [1, 2, 3] example.

how check if conversation exists id's in $participantids? above query return conversation has any of participants in array

so if have conversation john (2) , matt (4) try make conversation me , john query show have conversation john already


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -