I do a query on a table and obtain 25-30 results.
$items = item::all();
And then give it to the blade:
return view("myview",compact'items');
I display those results on my blade like this:
@foreach($items as $item)
<select onchange="changeTextInputs()">
<option value="{{item->id}}">{{$item->name}}<input type="hidden" value={{item->color}}>
<input type="hidden" value={{item->shape}}>
<input type="hidden" value={{item->color}}>
...
</option>
@endforeach
<input type ="text" value="" id="item_color">
<input type ="text" value="" id="item_shape">
...
When changing the select, my javascript fills the inputs with the information of each item - as intended. Everything works just fine.
I honestly don't like to put the hidden inputs in the selects. Anyone knows other way to do this on Laravel?