Skip to content

Instantly share code, notes, and snippets.

@TheMadav
Last active August 29, 2015 14:01
Show Gist options
  • Save TheMadav/563f182c2f38a405a872 to your computer and use it in GitHub Desktop.
Save TheMadav/563f182c2f38a405a872 to your computer and use it in GitHub Desktop.
Laravel Bootstrap Form fields
<?php
if ($errors->has($field) ):
echo "<div class='form-group has-error has-feedback'>";
elseif ( Input::old($field) && ! $errors->has($field) ):
echo "<div class='form-group has-success has-feedback'>";
else:
echo "<div class='form-group'>";
endif;
?>
{{ Form::label($field, trans($context.'.'.$field)) }}
{{ Form::password($field, array('class'=>'form-control', 'placeholder'=> trans($context.'.'.$field.'_placeholder')) ) }}
<?php
if ($errors->has($field) ):
echo '<span class="fa fa-exclamation-triangle form-control-feedback"></span>';
elseif ( Input::old($field) && ! $errors->has($field) ):
echo '<span class="fa fa-check-square form-control-feedback"></span>';
endif;
?>
@foreach($errors->get($field) as $message)
<p class="help-block">{{ $message }}</p>
@endforeach
</div>
<?php
if ($errors->has($field) ):
echo "<div class='form-group has-error has-feedback'>";
elseif ( Input::old($field) && ! $errors->has($field) ):
echo "<div class='form-group has-success has-feedback'>";
else:
echo "<div class='form-group'>";
endif;
?>
{{ Form::label($field, trans($context.'.'.$field)) }}
{{ Form::text($field, Input::old($field), array('class'=>'form-control', 'placeholder'=> trans($context.'.'.$field.'_placeholder')) ) }}
<?php
if ($errors->has($field) ):
echo '<span class="fa fa-exclamation-triangle form-control-feedback"></span>';
elseif ( Input::old($field) && ! $errors->has($field) ):
echo '<span class="fa fa-check-square form-control-feedback"></span>';
endif;
?>
@foreach($errors->get($field) as $message)
<p class="help-block">{{ $message }}</p>
@endforeach
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment