amk
6 months ago
256
4
Laravel

How to remove same object from two collection?

Posted 6 months ago by amk

first collection

[{ lo_assignment_id: 1, student_code: "2019A9999", status: 1 },
{ lo_assignment_id: 1, student_code: "2019A9999", status: 2 },
{ lo_assignment_id: 1, student_code: "2019A9999", status: 3 },
​{ lo_assignment_id: 2, student_code: "2019A9999", status: 1 },
​{ lo_assignment_id: 2, student_code: "2019A9999", status: 2 },
​{ lo_assignment_id: 2, student_code: "2019A9998", status: 2 },
​{ lo_assignment_id: 2, student_code: "2019A9998", status: 1 }]

second collection

[{ lo_assignment_id: 1, student_code: "2019A9999", status: 1 },
​​{ lo_assignment_id: 1, student_code: "2019A9999", status: 2 },
​​{ lo_assignment_id: 1, student_code: "2019A9999", status: 3 },
{ lo_assignment_id: 2, student_code: "2019A9998", status: 3 }]

I want to remove same object from both. Any idea?

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