derduesseldorf / formbuilder by derduesseldorf

Formbuilder Package to build Forms with validation
18
0
1
Package Data
Maintainer Username: derduesseldorf
Maintainer Contact: rheingestalter@gmail.com (Derduesseldorf)
Package Create Date: 2014-06-26
Package Last Update: 2014-06-26
Language: PHP
License: MIT
Last Refreshed: 2024-11-22 03:00:22
Package Statistics
Total Downloads: 18
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

#Formbuilder Package for Laravel A small formbuilder for Laravel Models

##About This Package is in early status.

##Installing Require this package in your composer.json

"derduesseldorf/formbuilder" : "dev-master"

After updating composer add the ServiceProvider to the providers in your app/config/app.php

"Derduesseldord\Formbuilder\FormbuilderServiceProvider"

Add the Facade to the aliases in app/config/app.php

"Formbuilder" => "Derduesseldorf\Formbuilder\FormBuilderFacade"

##Configuration

To publish the configuration for the Formbuilder Package run

php artisan config:publish derduesseldorf/formbuilder

###Possible Settings

  • use-labels
    is used to display labels in your form (Recommended: true)

  • wrapper-class
    sets the class around the form wrapper

  • section-class
    sets the class around the form sections / fields

  • form-class
    sets the class form the form

  • exclude-fields
    exclude fields from beeing displayed by default

  • form-types
    strongly recommended to leave as it is. Defines types for input fields

  • form-options
    Defines options for inputs

##The Form View

The view is located under

<root>/vendor/derduesseldorf/formbuilder/src/views/forms/formbuilder.blade.php

The HTML is clean. So you can style it your way.

##How to use

  • The simplest way
    $form = Formbuilder::form(new YourModel)->render();
    Assign $form to your View

  • With Form attributes
    $form = Formbuilder::form(new YourModel);
    $form->withAttributes(array('url' => 'actionurl', 'method' => 'post|get|put|delete'))
    $form = $form->render();
    Documentation on Laravel.com - Opening a form

  • With Field excludes
    $form = Formbuilder::form(new YourModel);
    $form->withAttributes(array('url' => 'actionurl', 'method' => 'post|get|put|delete'))
    $form->excludeFields(array('of', 'excluded', 'field'))
    $form = $form->render();

  • With Enable/Disable labels
    $form = Formbuilder::form(new YourModel);
    $form->withAttributes(array('url' => 'actionurl', 'method' => 'post|get|put|delete'))
    $form->excludeFields(array('of', 'excluded', 'field'))
    $form->withLabels(true|false) $form = $form->render();