I have three tables
1. users
id
name
email
2. Listings
id
user_id
name
3 ListingImage
id
list_id
image
Here i want a data in one query. where all data fetched based on users table (id) . i want data something like that
enter code here
Array
(
[user] => Array
(
[id] => 1
[name] =>abc
[email] => [email protected]
[listing]=>
Array
(
[id] => 1
[user_id] => 1
[name] => abc list
[listingimage] =>
[0] => Array
(
[id] => 1
[list_id] => 1
[image] => abc.jpg
)
[1] => Array
(
[id] => 2
[list_id] => 1
[image] => abc.jpg
)
)
)
)
i have used hasMany but it will not give me accurate result can anyone help me