Download the PHP package elnooronline/laravel-bootstrap-forms without Composer
On this page you can find all versions of the php package elnooronline/laravel-bootstrap-forms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elnooronline/laravel-bootstrap-forms
More information about elnooronline/laravel-bootstrap-forms
Files in elnooronline/laravel-bootstrap-forms
Package laravel-bootstrap-forms
Short Description Provides an easy way to use bootstrap components within your Laravel projects.
License MIT
Informations about the package laravel-bootstrap-forms
This package has been deprecated. But worry not. You can use laraeast/laravel-bootstrap-forms
Laravel Bootstrap Forms.
- Installation
- Opening A Form
- Text, Text Area, Date, Number & Password Fields
- Checkboxes and Radio Buttons
- Drop-Down Lists
- Generating A Submit Button
- Supported Methods
- Using Resource With Localed Fields
- Example Register Form
- Add Custom Style To The Component
- Using Multilingual Form Tabs
- Manage Locales
- Using Bootstrap 3
- Add Custom Component
Installation
Begin by installing this package through Composer. Edit your project's
composer.jsonfile to requireelnooronline/laravel-bootstrap-forms.You should publish the flags icons in public path to display in multilingual form tabs.
Opening A Form
By default, a
POSTmethod will be assumed; however, you are free to specify another method:Note: Since HTML forms only support
POSTandGET,PUTandDELETEmethods will be spoofed by automatically adding a_methodhidden field to your form.You may also open forms with method as well:
You may also open forms that point to named routes or controller actions:
You may pass in route parameters as well:
Text, Text Area, Date, Number & Password Fields
Generating A Text Input
Specifying A Default Value
Note: The date, number and textarea methods have the same signature as the text method.
Generating A Password Input
Generating Other Inputs
Checkboxes and Radio Buttons
Generating A Checkbox Or Radio Input
Drop-Down Lists
Generating A Drop-Down List With Selected Default
Generating a Drop-Down List With an Empty Placeholder
Generating A Grouped List
Generating A Submit Button
Generateing A Submit Button With Bootstrap Button Style
Supported Methods
->label($label): To Generate label to the specified field.
->name($name): To Generate label to the specified field.
->placeholder($placeholder): To Set placeholder attribute to the specified field.
->min($min): To Set min attribute to the specified number field.
->max($max): To Set max attribute to the specified number field.
->step($step): To Set step attribute to the specified number field.
->multiple($bool = true): To Set multiple attribute to the specified select and file fields.
->note($note): To Sethelp-blockto the specified field.
->name($name): To Set the name of to the specified field.
->value($value): To Set the value of to the specified field as default will setold('name').
->inlineValidation($bool = true): To display validation errors in the specified field.
->style($style = 'default'): To Set style to the specified field. supported['default', 'vertical'].
->close(): To close the form tag.
Using Resource With Localed Fields
You may add localed labels, notes and placeholders using resource option as well:
You must add
users.phpfile to theresources/lang/en/path and set the default attributes and notes, placeholders as well:
Using Custom Error Message Bag
You can using custom error bag to display validation errors without any conflict.
Example Register Form
Using Multilingual Form Tabs
Note : the input name inside
@bsMultilangualFormTabsand@endBsMultilangualFormTabssuffix with:{lang}.Ex. if your supported language is
ar&enthe input will named withname:ar&name:en.You should use Astrotomic/laravel-translatable and configure it's rule_factory with key format
\Astrotomic\Translatable\Validation\RuleFactory::FORMAT_KEYto fill the multilingual data like the following example.
Manage Locales
You can add your supported locales in
locales.phpconfig file. you will get it using the following command:
Using Bootstrap 3
If you want to use bootstrap 3 you should publish the config file using the following commad and set the bootstrap version globally.
After change bootstrap version you should clear the cached view files using the
view:clearartisan command.
Add Custom Style To The Component
run the
vendor:publishartusan command to override components views as well.will override components in
resources/views/vendor/BsFormpath.you can copy
default.blade.phpfile ascustom.blade.phpand use custom style as well :you can also set the style globally with
BsForm::style()method before the form open as well :or
To reset the custom style to the default you should call
clearStyle()method as well:For Example :
Add Custom Component
You may add new component class extends
BaseComponentand regoster it in yourboot()method inAppServiceProviderclass as well:Then register the component class in
boot()method in yourAppServiceProviderclass as well :Then publish the BsForm views and create the new component file in
views/vendor/BsForm/bootstrap4/components/image/default.blade.phppath.Eexample content of
views/vendor/BsForm/bootstrap4/components/image/default.blade.phpfile :
Usage
All versions of laravel-bootstrap-forms with dependencies
laravelcollective/html Version ^5.6|^6.0|^7.0
elnooronline/laravel-locales Version ^2.0