Reputation: 268
This Query is working
$conditions = [
'status' => '1',
'country' => "DK"
];
$offers = Offers::where($conditions)->get();
How can i use LIKE %% in this
When i tried this in single condition , its working
$offers = Offers::where('country' , 'LIKE' , '%DK%')->get();
Upvotes: 1
Views: 1557
Reputation: 4367
Did you try this?
$conditions = [
'status' => '1',
'country' => "DK"
];
$offers = Offers::where('country' , 'LIKE' , '%DK%')->where($conditions)->get();
You can chain your where clauses as much as you want.
Upvotes: 4
Reputation: 1748
Actually you can use where multiple times so you can try something like:
$offers = Offers::where('country' , 'LIKE' , '%DK%')
->where('status', 1)
->get();
I didn't test this but you can try also like this: ( It might work but I'm note sure )
$conditions = [
'status' => '1',
'country' => "LIKE %DK%"
];
$offers = Offers::where($conditions)->get();
Upvotes: 0