PHP code example of paulmenheere / laravel-bootstrap-4-forms

1. Go to this page and download the library: Download paulmenheere/laravel-bootstrap-4-forms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

paulmenheere / laravel-bootstrap-4-forms example snippets


Form::text('username', 'Username')

'providers' => [
    //...
	NetoJose\Bootstrap4Forms\Bootstrap4FormsServiceProvider::class,
],

'aliases' => [
    //...
    'Form' => NetoJose\Bootstrap4Forms\Bootstrap4FormsFacade::class,
],

// Opening a form using POST method

{!!Form::open()!!}
// ... Form components here
{!!Form::close()!!}

// Making all inputs inline
{!!Form::inlineForm()!!}

// Example
{!!Form::fieldsetOpen('Legend title')!!}
// ... fieldset content
{!!Form::fieldsetClose()!!}

// Example
{!!Form::text('name', 'User name')!!}

// Example
{!!Form::textarea('description', 'Description')!!}

// Example
{!!Form::select('city', 'Choose your city', [1 => 'Gotham City', 2 => 'Springfield'])!!}

{!!Form::select('city', 'Choose your city', [''=>'--choose your city---',1 => 'Gotham City', 2 => 'Springfield'])!!}

// Example
{!!Form::checkbox('orange', 'Orange')!!}

// Example
{!!Form::radio('orange', 'Orange')!!}

// Example
{!!Form::file('doc', 'Document')!!}

// Example
{!!Form::date('birthday', 'Birthday')!!}

// Example
{!!Form::time('hour', 'Meeting hour')!!}

// Example
{!!Form::range('name', 'User name')!!}

// Example
{!!Form::hidden('user_id')!!}

// Example
{!!Form::anchor("Link via parameter", 'foo/bar')!!}

// Example
{!!Form::submit("Send form")!!}

// Example
{!!Form::button("Do something", "warning", "lg")!!}

// Example
{!!Form::reset("Clear form")!!}

// Examples

// With initial data using a Model instance
$user = User::find(1);
{!!Form::open()->fill($user)!!}

// With initial array data
$user = ['name' => 'Jesus', 'age' => 33];
{!!Form::open()->fill($user)!!}

// Example
{!!Form::anchor("Link via url")->url('foo/bar')!!}

// Example
{!!Form::anchor("Link via route")->route('home')!!}

// Examples

// Using readonly field
{!!Form::checkbox('agree', 'I agree')->checked()!!}

// You can use FALSE to turn off checked status
{!!Form::checkbox('agree', 'I agree')->checked(false)!!}

// Examples
{!!Form::radio('orange', 'Orange')->inline()!!}

{!!Form::checkbox('orange', 'Orange')->inline()!!}

// Example
{!!Form::text('name', 'Name')->placeholder('Input placeholder')!!}

// Example
{!!Form::select('city', 'Choose your city', [1 => 'Gotham City', 2 => 'Springfield'])->multiple()!!}

// Example
{!!Form::open()->locale('forms.user')!!}

// Example
{!!Form::text('name', 'Name')->help('Help text here')!!}

// Example
{!!Form::text('name', 'Name')->attrs(['data-foo' => 'bar', 'rel'=> 'baz'])!!}

// Example
{!!Form::text('name', 'Name')->wrapperAttrs(['data-foo' => 'bar', 'id'=> 'name-wrapper'])!!}

// Examples

// Using readonly field
{!!Form::text('name', 'Name')->readonly()!!}

// You can use FALSE to turn off readonly status
{!!Form::text('name', 'Name')->readonly(false)!!}

// Examples

// Disabling a field
{!!Form::text('name', 'Name')->disabled()!!}

// Disabling a fieldset
{!!Form::fieldsetOpen('User data')->disabled()!!}

// You can use FALSE to turn off disabled status
{!!Form::text('name', 'Name')->disabled(false)!!}

// Examples

// Disabling a field
{!!Form::text('name', 'Name')->block()!!}

// You can use FALSE to turn off block status
{!!Form::text('name', 'Name')->block(false)!!}

// Examples

// Disabling a field
{!!Form::text('name', 'Name')->uired()!!}

// You can use FALSE to turn off 

// Examples

// Switch off autocomplete for the form
{!!Form::open()->autocomplete('off')!!}

// Explicitly set a autocomplete value
{!!Form::text('mobile', 'Mobile Number')->autocomplete('tel')!!}

// Disable autocomplete for fields with valid names
{!!Form::text('name', 'Name')->autocomplete('off')!!}

// Example
{!!Form::text('name', 'Name')->id('user-name')!!}

// Example
{!!Form::open()->idPrefix('register')!!}

// Examples
{!!Form::open()->multipart()!!}

// You can use FALSE to turn off multipart
{!!Form::open()->multipart(false)!!}

// Examples
{!!Form::open()->method('get')!!}
{!!Form::open()->method('post')!!}
{!!Form::open()->method('put')!!}
{!!Form::open()->method('patch')!!}
{!!Form::open()->method('delete')!!}

// Examples
{!!Form::open()->get()!!}
{!!Form::open()->post()!!}
{!!Form::open()->put()!!}
{!!Form::open()->patch()!!}
{!!Form::open()->delete()!!}

// Examples
{!!Form::button("Do something")->color("warning")!!}

{!!Form::button("Do something")->color("primary")!!}

// Examples
{!!Form::button("Button label")->warning()!!}
{!!Form::button("Button label")->outline()!!}
{!!Form::button("Button label")->success()!!
{!!Form::button("Button label")->danger()!!}
{!!Form::button("Button label")->secondary()!!}
{!!Form::button("Button label")->info()!!}
{!!Form::button("Button label")->light()!!}
{!!Form::button("Button label")->dark()!!}
{!!Form::button("Button label")->link()!!}

// Examples
{!!Form::button("Do something")->size("sm")!!}

{!!Form::button("Do something")->size("lg")!!}

// Examples
{!!Form::button("Button label")->sm()!!}
{!!Form::button("Button label")->lg()!!}

// Examples

// Password field
{!!Form::text('password', 'Your password')->type('password')!!}

// Number field
{!!Form::text('age', 'Your age')->type('number')!!}

// Email field
{!!Form::text('email', 'Your email')->type('email')!!}

// Examples
{!!Form::text('text')->name('name')!!}

// Examples
{!!Form::text('age')->label('Your age')!!}

// Example
{!!Form::text('name', 'Your name')->value('Maria')!!}

// Examples

// Number field
{!!Form::render('text')->name('age')->label('Your age')!!}

// Examples

{!!Form::open()->locale('forms.user')->put()->multipart()->route('user.add')->data($user)!!}

{!!Form::text('name', 'Name')->placeholder('Type your name')->lg()!!}

{!!Form::anchor("Link as a button")->sm()->info()->outline()!!}

{!!Form::submit('Awesome button')->id('my-btn')->disabled()->danger()->lg()!!}

{!!Form::close()!!}