I have a collection like the below. I need to fetch those users, whom does not uploaded documents. Now from the relationship, How can I fetch this?
 => Array ( [id] => 2 [user_id] => 8 [referred_by] => ........ [user_documents] => )  => Array ( [id] => 3 [user_id] => 9 [referred_by] => [reference_id] => NM1100008 ....... [user_documents] => Array ( [id] => 1 [customer_id] => 3 [doc_type] => 1 <div class="su-document su-u-responsive-media-yes"></div> => N8xFORsPpkTayTQ9Ihyz0ly7QM62TJHxvHhSFQSN.png [admin_comment] => [approve_status] => approve [other_gov_id] => [doc_no] => 1 [created_at] => 2020-04-04 12:39:12 [updated_at] => 2020-04-06 13:57:01 [deleted_at] => ) )
I want to get rows only when user_documents is empty.. To get those users who does not uploaded documents to the system.
Thanks in advance.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
You can use laravel querying-relationship-absence
Depending on how you have setup your relations, something like this should work: