PHPackages                             elnooronline/laravel-bootstrap-forms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. elnooronline/laravel-bootstrap-forms

Abandoned → [laraeast/laravel-bootstrap-forms](/?search=laraeast%2Flaravel-bootstrap-forms)ArchivedPackage[Utility &amp; Helpers](/categories/utility)

elnooronline/laravel-bootstrap-forms
====================================

Provides an easy way to use bootstrap components within your Laravel projects.

v4.0.1(5y ago)95.6k3[1 issues](https://github.com/Elnooronline/laravel-bootstrap-forms/issues)3MITPHP

Since Mar 4Pushed 5y ago2 watchersCompare

[ Source](https://github.com/Elnooronline/laravel-bootstrap-forms)[ Packagist](https://packagist.org/packages/elnooronline/laravel-bootstrap-forms)[ RSS](/packages/elnooronline-laravel-bootstrap-forms/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (17)Used By (3)

**This package has been deprecated. But worry not. You can use [laraeast/laravel-bootstrap-forms](https://github.com/laraeast/laravel-bootstrap-forms)**

\# Laravel Bootstrap Forms.
===========================

[](#-laravel-bootstrap-forms)

[![Build Status](https://camo.githubusercontent.com/31f57f306446a9cd60a9fa98255dacd84ca0b01e245beea62a32d2cc57f2a9a8/68747470733a2f2f7472617669732d63692e6f72672f656c6e6f6f726f6e6c696e652f6c61726176656c2d626f6f7473747261702d666f726d732e737667)](https://travis-ci.org/elnooronline/laravel-bootstrap-forms)[![Total Downloads](https://camo.githubusercontent.com/085968048684b0e938514104db22e201db1e2cb9f0caa04676b44e6a6900a1d2/68747470733a2f2f706f7365722e707567782e6f72672f656c6e6f6f726f6e6c696e652f6c61726176656c2d626f6f7473747261702d666f726d732f642f746f74616c2e737667)](https://packagist.org/packages/elnooronline/laravel-bootstrap-forms)[![Latest Stable Version](https://camo.githubusercontent.com/2c6157e0bbba36a4161e908d118e7350b035e2d62753fec74778b0d215c58ea6/68747470733a2f2f706f7365722e707567782e6f72672f656c6e6f6f726f6e6c696e652f6c61726176656c2d626f6f7473747261702d666f726d732f762f737461626c652e737667)](https://packagist.org/packages/elnooronline/laravel-bootstrap-forms)[![License](https://camo.githubusercontent.com/018917f33047f3fea6ebf608634a360e07a2cbfc63c39061ffc1df7d1845a412/68747470733a2f2f706f7365722e707567782e6f72672f656c6e6f6f726f6e6c696e652f6c61726176656c2d626f6f7473747261702d666f726d732f6c6963656e73652e737667)](https://packagist.org/packages/elnooronline/laravel-bootstrap-forms)

- [Installation](#installation)
- [Opening A Form](#opening-a-form)
- [Text, Text Area, Date, Number &amp; Password Fields](#fields)
- [Checkboxes and Radio Buttons](#checkboxes)
- [Drop-Down Lists](#dropdown)
- [Generating A Submit Button](#submit)
- [Supported Methods](#methods)
- [Using Resource With Localed Fields](#resource)
- [Example Register Form](#example)
- [Add Custom Style To The Component](#custom-style)
- [Using Multilingual Form Tabs](#multilingual)
- [Manage Locales](#locales)
- [Using Bootstrap 3](#bootstrap3)
- [Add Custom Component](#custom-component)

\# Installation
===============

[](#-installation)

> Begin by installing this package through Composer. Edit your project's `composer.json` file to require `elnooronline/laravel-bootstrap-forms`.

```
composer require elnooronline/laravel-bootstrap-forms
```

> You should publish the flags icons in public path to display in multilingual form tabs.

```
php artisan vendor:publish --tag=locales:flags
```

\# Opening A Form
=================

[](#-opening-a-form)

```
{{ BsForm::open(['url' => 'foo/bar']) }}
//
{{ BsForm::close() }}
```

> By default, a `POST` method will be assumed; however, you are free to specify another method:

```
{{ BsForm::open(['url' => 'foo/bar', 'method' => 'post']) }}
```

> Note: Since HTML forms only support `POST` and `GET`, `PUT` and `DELETE` methods will be spoofed by automatically adding a `_method` hidden field to your form.

> You may also open forms with method as well:

```
{{ BsForm::get('foo/bar') }}
{{ BsForm::post('foo/bar') }}
{{ BsForm::put('foo/bar') }}
{{ BsForm::patch('foo/bar') }}
{{ BsForm::delete('foo/bar') }}
{{ BsForm::model($model, 'foo/bar') }}
{{ BsForm::putModel($model, 'foo/bar') }}
{{ BsForm::patchModel($model, 'foo/bar') }}
```

> You may also open forms that point to named routes or controller actions:

```
{{ BsForm::open(['route' => 'route.name']) }}
{{ BsForm::open(['action' => 'Controller@method']) }}
```

> You may pass in route parameters as well:

```
{{ BsForm::open(['route' => ['route.name', $user->id]]) }}
{{ BsForm::open(['action' => ['Controller@method', $user->id]]) }}
```

\# Text, Text Area, Date, Number &amp; Password Fields
======================================================

[](#-text-text-area-date-number--password-fields)

> Generating A Text Input

```
{{ BsForm::text('username') }}
```

Specifying A Default Value
--------------------------

[](#specifying-a-default-value)

```
{{ BsForm::text('email', 'example@gmail.com') }}
{{ BsForm::text('email')->value('example@gmail.com') }}
```

> Note: The date, number and textarea methods have the same signature as the text method.

Generating A Password Input
---------------------------

[](#generating-a-password-input)

```
{{ BsForm::password('password', ['class' => 'awesome']) }}
{{ BsForm::password('password')->attr('class', 'awesome') }}
```

Generating Other Inputs
-----------------------

[](#generating-other-inputs)

```
{{ BsForm::email($name)->value($value)->label($label) }}
{{ BsForm::file($name)->label('Upload File') }}
```

\# Checkboxes and Radio Buttons
===============================

[](#-checkboxes-and-radio-buttons)

Generating A Checkbox Or Radio Input
------------------------------------

[](#generating-a-checkbox-or-radio-input)

```
{{ BsForm::checkbox('name', 'value')->checked(false) }}
{{ BsForm::checkbox('name')->value('value')->checked(false) }}

{{ BsForm::radio('name', 'value')->checked(false)->label('label') }}
{{ BsForm::radio('name')->value('value')->checked(false)->label('label') }}
```

\# Drop-Down Lists
==================

[](#-drop-down-lists)

```
{{ BsForm::select('size', ['L' => 'Large', 'S' => 'Small']) }}
{{ BsForm::select('size')->options(['L' => 'Large', 'S' => 'Small']) }}
```

Generating A Drop-Down List With Selected Default
-------------------------------------------------

[](#generating-a-drop-down-list-with-selected-default)

```
{{ BsForm::select('size')->options(['L' => 'Large', 'S' => 'Small'])->value('S') }}
```

Generating a Drop-Down List With an Empty Placeholder
-----------------------------------------------------

[](#generating-a-drop-down-list-with-an-empty-placeholder)

```
{{ BsForm::select('size')->options(['L' => 'Large', 'S' => 'Small'])->placeholder('Select Size') }}
```

Generating A Grouped List
-------------------------

[](#generating-a-grouped-list)

```
{{ BsForm::select('animal',[
         'Cats' => ['leopard' => 'Leopard'],
         'Dogs' => ['spaniel' => 'Spaniel'],
   ]) }}
```

\# Generating A Submit Button
=============================

[](#-generating-a-submit-button)

```
{{ BsForm::submit('Click Me!') }}
```

Generateing A Submit Button With Bootstrap Button Style
-------------------------------------------------------

[](#generateing-a-submit-button-with-bootstrap-button-style)

```
{{ BsForm::submit('Click Me!')->success() }}
{{ BsForm::submit('Click Me!')->primary() }}
{{ BsForm::submit('Click Me!')->info() }}
{{ BsForm::submit('Click Me!')->warning() }}
{{ BsForm::submit('Click Me!')->danger() }}
```

\# Supported Methods
====================

[](#-supported-methods)

> `->label($label) ` : To Generate label to the specified field.

```
{{ BsForm::text('username')->label('Username') }}
```

> `->name($name) ` : To Generate label to the specified field.

```
{{ BsForm::text('username')->label('Username') }}
```

> `->placeholder($placeholder) ` : To Set placeholder attribute to the specified field.

```
{{ BsForm::text('username')->placeholder('Please Enter Your Name') }}
```

> `->min($min)` : To Set min attribute to the specified number field.

```
{{ BsForm::number('age')->min(10) }}
```

> `->max($max)` : To Set max attribute to the specified number field.

```
{{ BsForm::number('age')->min(10)->max(30) }}
```

> `->step($step)` : To Set step attribute to the specified number field.

```
{{ BsForm::number('age')->min(10)->max(30)->step(1) }}
```

> `->multiple($bool = true)` : To Set multiple attribute to the specified select and file fields.

```
{{ BsForm::file('photos[]')->multiple() }}
```

> `->note($note)` : To Set `help-block` to the specified field.

```
{{ BsForm::text('username')->note('Example: Ahmed Fathy') }}
```

> `->name($name)` : To Set the name of to the specified field.

```
{{ BsForm::text()->name('username')->note('Example: Ahmed Fathy') }}
```

> `->value($value)` : To Set the value of to the specified field as default will set `old('name')`.

```
{{ BsForm::text()->name('username')->value('Ahmed Fathy') }}
```

> `->inlineValidation($bool = true)` : To display validation errors in the specified field.

```
{{ BsForm::text('username')->style('vertical')->inlineValidation(false) }}
```

> `->style($style = 'default')` : To Set style to the specified field. supported `['default', 'vertical']`.

```
{{ BsForm::text('username')->style('vertical') }}
{{ BsForm::text('email')->style('default') }}
```

> `->close()` : To close the form tag.

```
{{ BsForm::close() }}
```

\# Using Resource With Localed Fields
=====================================

[](#-using-resource-with-localed-fields)

> You may add localed labels, notes and placeholders using resource option as well:

```
@php(BsForm::resource('users'))
```

> You must add `users.php` file to the `resources/lang/en/` path and set the default attributes and notes, placeholders as well:

```
