skip to Main Content

Laravel looping in blade

Route::get('/pizza', function () { $edibles = [ 'fruits' => 'Apple', 'beverage' => 'Milo', 'soup' => 'Egusi', 'drink' => 'cocacola', ]; return view('pizza', $edibles); }); @foreach ($edibles as $data) {{ $data }} @endforeach It has been saying Undefined ErrorException PHP 8.1.6…

VIEW QUESTION

show array item on blade laravel

Arrays: [ {"id":1,"group":"post","name":"Mi","value":"x3 poco"}, {"id":2,"group":"post","name":"iPhone","value":"14 pro"}, {"id":3,"group":"post","name":"Nokia","value":"C5"}, {"id":4,"group":"post","name":"Dell","value":"15 insp"} . . . ] IndexController.php file: $post = Post::all(); return view('index', compact('post')); index.blade.php file: Post Name: "{{ $post->name['iPhone']->value }}" I want to show the output as below: Post Name: "14 pro"…

VIEW QUESTION
Back To Top
Search