Reputation: 560
What is the Laravel eloquent query for this:
select * from `jobs` where 1 between min_experience and max_experience;
I tried the below query but this one encapsulates the where 1 with single quotes.
Job::whereRaw('? between min_experience and max_experience',1)->get();
select * from `jobs` where '1' between min_experience and max_experience;
Upvotes: 3
Views: 12703
Reputation: 612
operator must like this
level_rank::where('min_pv', '>=', $pv)->where('max_pv', '<=', $pv)->first();
Upvotes: 0
Reputation: 56
Laravel have whereBetween query will work
Job::whereBetween('max_experience', [1, 1])->get();
Upvotes: -4
Reputation: 163758
Probably this will work for you:
Job::where('min_experience', '<', 1)->where('max_experience', '>', 1)->get();
Upvotes: 10