Git Product home page Git Product logo

laravel-bootstrap's Introduction

Bootsparks Bundle

Twitter's Bootstrap Forms support in Laravel.

## Installation

Install via the Artisan CLI:

php artisan bundle:install bootsparks

Bundle Registration

Add the following to your application/bundles.php file:

'bootsparks' => array(
    'autoloads' => array(
        'map' => array(
            'Bootsparks\\Form' => '(:bundle)/form.php',
        ),
    ),
),

Class Alias

Bootsparks\Form extends Laravel\Form so you can use it to replace your existing form code. To do this you'll need to edit application/config/application.php and update the alias for Form.

Guide

Here's an example of a Login form using Bootsparks:

<article>
	<h1>Log in</h1>

	<?php echo Form::open(URL::to('login'), 'POST', array('class' => Form::TYPE_HORIZONTAL)); ?>
	<?php echo Form::token(); ?>
	<?php echo Form::hidden('from', Input::get('from', Request::uri() === 'login' ? '' : Request::uri())); ?>

	<?php if ($errors->has('login')): ?>
		<?php echo $errors->first('login', '<div class="alert-message error">:message</div>'); ?>
	<?php endif; ?>

	<?php echo Form::field('email', 'email', 'E-mail Address', array(Input::get('email')), array('error' => $errors->has('email'))); ?>
	<?php echo Form::field('password', 'password', 'Password', array(), array('error' => $errors->has('password'))); ?>
	<?php echo Form::field('labelled_checkbox', 'remember', '', array('Use a '.HTML::link('cookies', 'cookie', array('title' => 'Find out more about the cookies we use and how to delete them', 'rel' => 'twipsy', 'target' => '_blank')).' to remember my details', 'yes')); ?>

	<?php echo Form::actions(Form::submit("Log in", array('class' => 'primary'))); ?>

	<?php echo Form::close(); ?>
</article>

The Form::field method allows you to generate a field for any Form:: field. The parameters are:

  • $type (string) Any Laravel\Form method with $name as the first parameter.
  • $name (string) The name of the HTML field.
  • $label (string) A HTML label for this field.
  • $args (array) Additional parameters passed in order to the Form method.
  • $opts (array) Additional form field parameters; help, error, warning or success.

laravel-bootstrap's People

Contributors

henninghorn avatar sparksp avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.