Currently in my controller I've got the following:
public function create(Request $request)
{
$categories = Categories::all();
$list = [];
foreach ($categories as $category) {
$list[] = [
$category->id => $category->name
];
}
return view('frontend.user.project', [
'categories' => $list
]);
}
This is so I can populate my form using the html() helper, here's what I've got inside my view:
<div class="row">
<div class="col">
<div class="form-group">
{{ html()->label(__('validation.attributes.frontend.category'))->for('category') }}
{{ html()->select('category', $categories)->class('form-control') }}
</div><!--form-group-->
</div><!--col-->
</div><!--row-->
What's an easier/cleaner approach instead of creating another array?