Can you rephrase you question, and wrap any code snippets properly in 3 backticks (```)?
I need following output of query using laravel.
table-1
id
1
table-2
fk_id deleted_at
1 null
1 not null
1 not null
output :- Not Need any output because id-1 one record are not deleted.
In short I need all those id that all records are deleted like this,
table-1
id
1
2
table-2
id fk_id deleted_at
1 2 not null
2 2 not null
3 2 not null
4 1 null
5 1 not null
6 1 not null
output:- I need id-2 must be in output because all record of id-2 is deleted.
I need above id found result using laravel Eloquent query.
This is my query code :-
$query = table-1->select('table1.id as table_1_id','table2.id as table_2_id') ->leftJoin('table2', 'table2.fk_id', '=', 'table1.id') ->whereNull('table2.id') ->whereNull('table2.deleted_at')
->orWhere(function($query)
{
$query->whereNotNull('table2.deleted_at')
->where('table2.deleted_at','!=',NULL);
})
->get()
->toArray();
But i am still not getting expected output
Please or to participate in this conversation.