I've a requirement to convert this to Laravel Query Builder:
Raw SQL:
Select * from requests where user_id in (select user_id from profiles where total_sales <= 10);
This is my Query builder:
public static function apply(Builder $builder, $value)
{
return $builder->where('user_id', function($query) use ($value) {
$query->where('profiles.total_sales','<=',$value);
});
}
This is not working. What am I missing?
PS: This is a portion of large dynamic query and this is the portion that is not working so, I'm posting only this portion of the query.