Using IF Condition Inside a query in Laravel
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 …