2 weeks ago

Laravel Eloquent problem

Posted 2 weeks ago by engrlaravel

I have below query

 $tasks = Task::where('deleted_at', null)->where('status',0);
 $tasks = $tasks->orWhereIn('id',$task_ids);

Generated query

 SELECT * FROM `tasks` WHERE `deleted_at` IS NULL AND `status` = 0 OR `id` IN (80,101,107,112,113,133,134,184) ORDER BY `id`

Problem is there are some task ids (113,133,134) who status =2. I want only to get all records of status =0 even it is IN condition.

Please sign in or create an account to participate in this conversation.