I have a users table. Inside there is a column called city_id.
Inside the city_id column data are stored like this :for ex:["12,54,87,18"]
Now I want to select user/users whose city_id exists or is equal to the $postcity variable.
for ex:
$postcity = 54;
my code for select:
$usermatchings = DB::table('users')
->Where('city_id', $postcity )
->get();
foreach ($usermatchings as $usermatching) {
$recipients = $usermatching->phone;
}
dd($recipients);
but not working... please guide me.thank you
citiestable and associating manyToMany relations (along withcity_usertable) where you would store current relations. It would speed up things a lot.