N
N
Northern Lights2019-10-23 18:22:12
Laravel
Northern Lights, 2019-10-23 18:22:12

How to beautifully fill select from a collection of objects without loops?

We get an array of objects:

$docunent_types = DocumentType::all()->sortBy('name');

Is there a beautiful solution out of the box to pass the necessary values ​​​​from this dataset to the select?
{{ html()->select('type', $docunent_types)
    ->class('form-control w-50')
}}

why not write a cycle?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2019-10-23
@php666

https://laravel.com/docs/6.x/collections

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question