0
I have three tables
1. users
id
name
email
2. Listings
id
user_id
name
3 ListingImage
id
list_id
image
這裏我想要一個查詢中的數據。所有根據用戶表格(id)提取的數據。 我想數據類似的東西如何從laravel中的多個表中提取數據
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
)
)
)
)
我已經使用的hasMany,但它不會給我準確的結果誰能幫助我
做工精細Mahfuzul阿拉姆。現在,我面臨一個問題,我只想要一個列表與多個圖像。它返回我列表索引開始0 – kunal
,如果你只想要一個列表,然後在'listings()'關係中將'hasMany'改爲'hasOne'。簡單! –
非常感謝你:)這意味着很多:) – kunal