で働いていないネストされたループが私の見解で、私のネストされたlooopはforeachのために供給される。このなぜここlaravel
無効な引数のような
<ul>
@foreach($users as $m)
<li> {{$m->namecategory}}
<ul>
@foreach($m->namesubcategory as $nam)
<li>{{$nam->namesubcategory}}
<ul>
@foreach($nam->namesubling as $lan)
<li>{{$lan->namesubling}}</li>
@endforeach
</ul>
</li>
@endforeach
</ul>
</li>
@endforeach
</ul>
その投げるエラー私を助けてください動作していない理由を私は知りません()(閲覧
ここ出力が使用され、DD($ユーザー)
array:3 [▼
0 => {#209 ▼
+"idcategory": 1
+"namecategory": "mobile and assces"
+"created_at": null
+"updated_at": null
+"idsubcategory": 1
+"namesubcategory": "mobile"
+"idcategory_mastercategory": 1
+"idsubling": 1
+"namesubling": "iphone"
+"idsubcategory_subcategory": 1
}
1 => {#211 ▼
+"idcategory": 1
+"namecategory": "mobile and assces"
+"created_at": null
+"updated_at": null
+"idsubcategory": 2
+"namesubcategory": "mobile cover"
+"idcategory_mastercategory": 1
+"idsubling": 2
+"namesubling": "nexu cover"
+"idsubcategory_subcategory": 2
}
2 => {#212 ▼
+"idcategory": 2
+"namecategory": "elect"
+"created_at": null
+"updated_at": null
+"idsubcategory": 3
+"namesubcategory": "lap"
+"idcategory_mastercategory": 2
+"idsubling": 3
+"namesubling": "hp"
+"idsubcategory_subcategory": 3
}
]
とIMにしようあなたのvar_dump、$ M-> namesubcategoryによると、この
-mobile and accessory (mastercategory)
1.mobile(subcategory)
1.iphone(subling)
2.mobile cover(subcategory)
1.iphone cover(subling)
-electronic(mastercategory)
1.laptop(subcategory)
1.hp(subling)
'sub'は、$ m''には存在しないので? –
$ users配列を出力して、配列に問題があるかどうかを確認できますか? – manian
ようこそ! [ツアー]を見て回り、[ヘルプ]、特に[*良い質問をするにはどうすればいいですか?*](/助け/やり方)を読んでください。上記の詳細を参考にしてください。 –