The task for me today was to filter the products as per their status i.e if they are published then their value would be 1 and if they are unpublished then their value would be 0. But I didn’t want to create three queries for them, one for each condition. Therefore, I used the if condition inside query like this.
But I didn’t have an answer to what to do to get all the products whatever their status maybe so I kept the else field empty.
The code is down below. I passed the $status variable which has either ‘published’ or ‘unpublished’ or ‘all’ condition.
return Product::where(function($query) use ($status) {
if($status == 'published') {
$query->where('product_status', 1);
}
elseif ($status == 'unpublished'){
$query->where('product_status', 0);
}
else {
}
})
->get();
I hope this helps you too.
I like this website very much so much wonderful info .
mexican border pharmacies shipping to usa
https://cmqpharma.com/# mexican border pharmacies shipping to usa
medicine in mexico pharmacies
Once you get on the cycle, it ll be better for you and the people priligy tablet
My brother suggested I might like this blog. He was totally right.
This post actually made my day. You can not imagine simply how much time I had spent
for this information! Thanks!
free samples of priligy My concern is should I try Pregnitude if my cycles are regular
paxil or priligy Koji Takaori, Jin Nakamura, Shinya Yamamoto, Hirosuke Nakata, Yuki Sato, Masayuki Takase, Masaaki Nameta, Tadashi Yamamoto, Aris N
how to buy cytotec without dr prescription Dapsone was shown to be effective in most cases of Indian cutaneous leishmaniasis after 6 weeks of therapy
Effects of Long Term Eteplirsen Treatment on Upper Limb Function in Patients with Duchenne Muscular Dystrophy Findings of 2 Phase 2 Trials buy clomid online store pick up NDC 62332 427 31 Bottles of 100 NDC 62332 427 71 Bottles of 500