Thursday, March 16, 2017

Laravel - option value form

Welcome ! I have a problem . I try to connect via relations two models. If i create note it belongs to only one user. Problem is that in form options don't know why it doesn't display me users from database.

NotesController :

public function create()

{
    $data['pilots'] = Pilot::all();
    return view('uwagi.create',$data);

}

Create blade:

<label>Pilot</label>
  <select class="form-control" id="pilot" name="pilots[]">
    @foreach($pilots as $pilot)
      <option value="{!! $pilot->id !!}"
        {!! $pilot->name !!}
      </option>


    @endforeach
  </select>

Regards and thank u for help



via tomczas

Advertisement