lundi 4 janvier 2016

Laravel : Form Data Binding

I need to bind the data to the related field using Form data binding , but the data does not showed on the fields at all.I don't know what the problem exactly that prevent the data to appear.

Controller:

public function edit($id){
$datum = RatingDatum::findorfail(1);
 return view('rating.index',compact('datum'));
}

View:

<div class="plan bg-plan">
   {!! Form::model($datums,['method' => 'PATCH','action'=>'RatingDataController@update'],$datums->id]) !!}  
   <div class="radio">
           <label>
             {!! Form::radio('customize_question_id')!!}{{$datums->value}}
            </label>
   </div>

   <div class="form-group">
       {!! Form::label('comment','Comment :') !!}
       {!! Form::textarea('comment' ,null,['class'=>'form-control', 'rows' => 4]) !!}

       {!! Form::label('reference','Reference:') !!}
       {!! Form::textarea('reference',null,['class'=>'form-control', 'rows' => 1]) !!}
   </div>
       {!! Form::submit('Submit Data', ['class' => 'btn btn-success submit']) !!}
       {!! Form::close() !!}
   </div>

dd($datum);

#attributes: array:15 [▼
    "id" => 1
    "organisation_id" => 8
    "sector_id" => 1
    "country_id" => 1
    "dimension_id" => 12
    "question_angle_id" => 1
    "customize_criteria_id" => 33
    "customize_question_id" => 7591
    "question_weight" => 20
    "actual_score" => 75
    "value" => "The company has made a formal commitment to promoting voluntary community initiatives and has set up quantitative targets in this regard."
    "comment" => ""
    "reference" => ""
    "created_at" => "2015-12-21 11:28:38"
    "updated_at" => "2015-12-21 12:22:25"
  ]



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1mzhfHV
via IFTTT

Aucun commentaire:

Enregistrer un commentaire