Answer the question
In order to leave comments, you need to log in
How to display data in laravel without foreach in view?
Hi all.
Is it possible to display data in a view so that we don't have to use a foreach loop?
example
Model
...
$users = Settings::All();
return $this->renderContent(
view('admin.settings.index',compact('users')),
trans('Users')
);
....
@foreach($users as $user)
<h3>{{ $user['name'] }}</h3>
@endforeach
$users = Settings::All()->foreach;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question