Search code examples
laraveleloquent-relationship

How to relation with two table when column value is a array in Laravel


I need all reports with all officers included in the participants column.

please check the attached image.

https://prnt.sc/CRoELD48J-L5


Solution

  • You should really have a participant pivot table with report_id and officer_id, and create proper relationships.

    What you're asking for is possible through loops and lazy loading, but it will be extremely slow and unoptimized.