lundi 6 janvier 2020

Set ID for select option in Laravel Collective

I have the following in my controller:

$companies = Company::pluck('title', 'id')->toArray();

Which gets send to a view with a form using Laravel Collective. Inside this view i have the following piece of code to show the array in the select box:

<div class="form-check">
      <br>
      
</div>

This generates the given title in a dropbox, as intended. However, i wnat my ID's to be the same as my company_id from my controller. Now it's just a list from 0 to the array's length.

How can I achieve this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire