2017 © Pedro Peláez
 

library laform

Laravel form builder

image

karan/laform

Laravel form builder

  • Sunday, February 28, 2016
  • by karan
  • Repository
  • 1 Watchers
  • 2 Stars
  • 192 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel form builder for Laravel 5, (*1)

Installation

Require this package in your composer.json and update composer. This will download the package., (*2)

"karan/laform": "dev-master"

Then add Service provider to config/app.php, (*3)

Karan\Laform\LaformServiceProvider::class,

And Facade (also in config/app.php), (*4)

'Laform'    => Karan\Laform\Facade::class

Basic Usage

Syntax, (*5)

{!! Laform::field('fildname','fildtype','attributes') !!}

Examples, (*6)

{!! Laform::open(array('url'=>'admin/formtest','class'=>'form-horizontal')) !!}

{!! Laform::field('name','text',['label'=>'Name']) !!}

{!! Laform::field('email','email',['label'=>'Email address']) !!}

{!! Laform::field('password','password',['label'=>'Password']) !!}

{!! Laform::field('password_confirmation','password',['label'=>'Confirm Password']) !!}

{!! Laform::field('role_id[]','select',
['label'=>'Select Roles',
'options'=>[1=>'Admin',2=>'Siteadmin'],
'attr'=>['multiple'=>'multiple']]) !!}

{!! Laform::field('test_textarea','textarea',['label'=>'Text Area','attr'=>['rows'=>'5','cols'=>'10']]) !!}

{!! Laform::field('test_chexbox','checkbox',['option'=>'1','label'=>'test Checkox']) !!}

{!! Laform::field('test_radio','radio',['option'=>'1','label'=>'test Checkox']) !!}

{!! Laform::field('test_chexboxs[]','checkboxs',['option'=>['1'=>'option 1','2'=>'option 2',
'3'=>'option 3'],'label'=>'test Checkox']) !!}

{!! Laform::close() !!}

Available common attributes Array

[    
    //field value (use to set field value) - string/array (depends upon field type)
    'value' => '' // default is null

    //field attributes - array
    'attr' => [] // default is empty array

    //lable text - string
    'lable'   => '' // no default value, if not set lavle will not be displayed

    //lable attributes - array
    'label_attr'   => [] // default is empty array

    //template name
    'template' => '' // default is whatever set in config

    //custom wrapper prefix - can contain html
    'prefix'   => '' // default is empty

    //custom wrapper suffix - can contain html
    'suffix'   => '' // default is empty

    //field wrapper prefix - can contain html
    'field_prefix'   => '' // default is empty

    //field wrapper prefix - can contain html
    'field_suffix'   => '' // default is empty

    //wrapper - true/false
    'wrapper'   => '' // default is true

    //wrapper attributes - array
    'wrapper_attr'   => [] // default is empty array

    //show error blocks or not - true/flase
    'show_errors'   => '' // default is true

    //error attributes - array
    'error_attr'   => [] // default is empty array

    //help block
    'help_block'   => [
        'text' => '' // default is empty
        'attr' => [] // default is empty array
    ]

]

The Versions

28/02 2016

dev-master

9999999-dev

Laravel form builder

  Sources   Download

MIT

The Requires

 

by Karan Jilka

laravel bootstrap field forms