Here all values of metakey and metavalue are string type.hence price 200 and 100 both are string too. I want to filter users within minimum and maximum price.But i am struggling to do so because 200 and 100 both are string.
UsersTable
id|name
1|xx
UserMeta table
id | user_id | metaKey | metavalue
1 | 1 | city | kolkata
2 |2 |city | london
3 |8 |city |london
4 |1 |price |200
5|8 |price |100
what I tried:
return User::whereHas('UserMeta', function ($query) use ($value) {
$query->where('meta_key', 'price')
->where('meta_value','< =', intval($value));
});