List item
I need to select data from a table whose id does not exits in another table or if exists then check other conditions. i can achieve this by
Task::join('events','events.task_id' ,'=','tasks.id')
->where('events.event_type','=','Task')
->where('events.task_stage','!=','assigned')->select('tasks.*');
but i don't think this is the right way.
For Example:
+-------------------------+ +-------------------------+
| tasks | | Events |
+----------+--------------+ +-------------------------+
| id | name | | task_id | task_stage |
| 1 | Task1 | | 1 | 'assigned' |
| 2 | Task2 | | 2 | 'created' |
+----------+--------------+ +----------+--------------+
Result Should be:
Task with id 2 which is only created not assigned. I am new to queries. Thanks in advance...