Within Blade, {{ dd(get_defined_vars()['__data']) }} gives me this output:
array:6 [▼
"__env" => Factory {#152 ▶}
"app" => Application {#2 ▶}
"errors" => ViewErrorBag {#145 ▶}
0 => array:1 [▼
"question" => "question 3"
]
1 => array:1 [▼
"question" => "question 2"
]
2 => array:1 [▼
"question" => "question 1"
]
]
My controller builds this data like so:
foreach ($questions as $question) {
$answer = [
'question' => $question->question,
];
$answers[] = $answer;
}
return view('results')->with($answers);
How do I iterate over this in Blade to display the 3 questions?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire