I have a table named as users:
id | name | email
and attachment table
id | file_name | user_id | type
1 filename1.jpg 56 7
2 filename2.jpg 56 7
3 filename3.jpg 57 7
4 filename4.jpg 56 6
I'm fetching data from users table like:
$data = Users::find($id);
but I want to get attachment table data also with users table. But I want to match user_id and type also, where user_id matches and type = 7 only those rows should return.