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…