mraiur / laravel-enhanced-form by mraiur

47
0
1
Package Data
Maintainer Username: mraiur
Maintainer Contact: mraiur@gmail.com (Nikolai Ivanov)
Package Create Date: 2015-02-15
Package Last Update: 2015-03-21
Language: PHP
License: MIT
Last Refreshed: 2024-11-29 15:17:10
Package Statistics
Total Downloads: 47
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

laravel-enhanced-form

Extend Laravel forms to add convinient access and helps. The package is extending the Laravels Html/From package to add additional functionality.

Example select :

{!! Form::ariaSelect('test', [
    ['id' => 0, 'label' => '---++---', 'role' => 'test', 'selected'=>'selected'],
    ['id' => 1, 'label' => 'title->a', 'role' => 'test'],
    ['id' => 2, 'label' => 'title->b', 'role' => 'admi', 'penka' => '1']
], null, [
    'option' => [
        'displayField'=> 'label',
        'valueField' => 'id',
        'aria' => 'role,id'
    ]
, 'placeholder' => 'placeholder text', 'custom-data' => 1, 'aria' => 'custom-data']) !!}

Output:

<select placeholder="placeholder text" data-custom-data="1" name="test">
    <option value="0" data-id="0" data-role="test">---++---</option>
    <option value="1" data-id="1" data-role="test">title-&gt;a</option>
    <option value="2" data-id="2" data-role="admi">title-&gt;b</option>
</select>

New component using hidden input by default for easy form data access via js for example.

{!! Form::aria(['aria' => 'role,myid', 'name' => 'testName'], [
    'value' => 'TEST',
    'role' => "admin",
    'myid' => 1
]) !!}

Output:

<input name="testName" type="hidden" value="TEST" data-role="admin" data-myid="1">

Setting the aria value to a comma separated list will add the matching Model attributes.

Setup

After install add to your app.php in providers array:

'Illuminate\Html\HtmlServiceProvider',
"Mraiur\EnhancedForm\FormServiceProvider"

Add to aliases array:

'Form'=> 'Illuminate\Html\FormFacade', 
'HTML'=> 'Illuminate\Html\HtmlFacade'