jarnstedt/former

Laravel 4 form builder with Twitter Bootstrap styling

dev-master 2014-12-10 10:23 UTC

README

Laravel 4 form builder with Twitter Bootstrap styling. Extends Laravels own form builder.

  • Set form defaults
  • Repopulate forms
  • Show validation errors

Install

Add this to composer.json and run composer update.

"require": {
   "jarnstedt/former": "dev-master"
},

Add this to Laravel providers array in app/config/app.php file.

'Jarnstedt\Former\FormerServiceProvider',

Add this to aliases array.

'Former' => 'Jarnstedt\Former\FormerFacade'

Usage

Example form

// controller
$user = User::find(1);
$form = Former::make($user);

// view
{{ $form->open() }}
{{ $form->text('name', 'Your name.req', 'default value', array('class' => 'className')) }}
{{ $form->select('city', 'City', array('City1', 'City2')) }}
{{ $form->submit('Save') }}
{{ $form->close() }}