- Blade Form Select Option
Blade Form Template code for Select.{{Form::select( 'revenue_var', $revDistrict , (isset($data) && !empty( $data )) ? $data['dist_id'] : ' ', ['class' => 'form-control required', 'tabindex'=>$tabindex++, 'placeholder'=> '----Select District.----']) }}
(isset($data) && !empty( $data )) ? $data['dist_id'] : ' '
The isset() method checks whether a variable is set and declared and is not NULL. isset() function returns true value if the variable exists and is not NULL or it will returns false.
empty() method checks whether variable is empty or not. empty() function return false if variable exists and is not empty, or it will returns true.
Ternary Operator [ ?: ]
( ExpressionA ? ExpressionB : ExpressionC )(isset($data) && !empty( $data )) ? $data['dist_id'] : ' '
In this ExpressionA is evaluated first. If ExpressionA will be True then ExpressionB will be executed and the result will be returned. Otherwise, if the ExpressionA is false then ExpressionC will be executed and the result will be returned.
- Blade Form Text Field
{{ Form::text( 'name', (isset($data) && !empty( $data )) ? $data['name'] : ' ', ['class' => 'form-control ', 'tabindex'=>$tabindex++, 'placeholder'=>'Enter Name'] ) }}
Blade Form Template code for Textbox.
- Blade Form Radio Field
{{ Form::radio('gender', 'MALE ', true , (isset($data) && !empty($data) && $data['gender'] == 'MALE') ? true : false, array("required")) }}
{{ Form::radio('gender' , 'FEMALE', false , (isset($data) && !empty($data) && $data['gender'] == 'FEMALE') ? true : false ) }}
Blade Form Template code for Radio
- Blade Form Checkbox Field
{{ Form::checkbox( 1stArgument, 2ndArgument, 3rdArgument, 4thArgument ) }}
First argument : name
Second argument : value
Third argument : checked or not checked this takes: true or false
Fourth argument : additional attributes (e.g., checkbox css classe)