mercredi 2 mai 2018

Passing id of optoin value back. But object doesn't have data in controller

I'm trying to pass back the id of an option in a select box. That's done like so in the view.

<div class="col-md-10">
                  <select class="form-control" id="item" name="item">
                    <!--Gets all items from DB -->
                    @foreach ($items as $item)
                      <option value=""></option>
                    @endforeach
                  </select>
                </div>
              </div>

In the controller I can recieve it just fine

$selectedItemId = $request->item;

    $items = itemList::where('id', $selectedPropertyId);
    dd($items);

But the $item object, is populated with all the attributes from the db



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire