mahmoudtrageh
1 month ago
138
4
Laravel

How can I match these two arrays and get users ?

Posted 1 month ago by mahmoudtrageh

I have this array resulted from checkboxes in blade

$array:2 [ 0 => "Health" 1 => "Legal" ]

$interest = $array:2 [ 0 => "Health" 1 => "Legal" ]

I want to match it with that field in firebase

"interests" => array:1 [ "Health" => true, "Legal" => true, ]

to get users have one of these interests

I try this but not working

$users = $db->collection('users')->where('interests', 'array-contains-any', $interest)->documents();

Please sign in or create an account to participate in this conversation.