2016-04-30 24 views
5

Bindung Ich habe über Form Modell gelesen https://laravelcollective.com/docs/5.0/html#form-model-bindingForm Modell in Laravel 5.2

Bindung Es ist sehr cool DB-Werte in HTML-Form zu füllen. Ich habe es versucht und das funktioniert fantastisch.

{{ Form::model($university,array('url' => admin_path('universities/edit'),'id' => 'add_university','name' =>'add_university','data-validate'=>"parsley")) }} 
    {{ Form::label('university_name', 'University name',array('class'=>'control-label')) }} 
    {{ Form::text('university_name')}} 
{{Form::close()}} 

Aber das Problem ist hier, Weil ich mehr Attribute in der Eingabe wie class SO hinzufügen möchte i

{{ Form::label('university_name', 'University name',array('class'=>'control-label')) }} 
{{ Form::text('university_name','',array('class' => 'form-control'))}} 

bin mit Wenn ich value Spalt dann nichts bevölkert in Textbox leer lassen, und wenn ich mit wie das

{{ Form::label('university_name', 'University name',array('class'=>'control-label')) }} 
{{ Form::text('university_name',$university->university_name,array('class' => 'form-control'))}} 

Dann was ist die Verwendung von Modell verbindlich. Bitte erläutern. Dank

Antwort

3
{{ Form::text('university_name','',array('class' => 'form-control'))}} 

Es sollte:

{{ Form::text('university_name',null,array('class' => 'form-control'))}} 

'' die wirkliche Zeichenfolge, nicht null.
danke, mathielo, für die Hilfe auf Grammatik