am2studio/laravel-admin-form

Admin form helper

v2.0.1 2017-10-30 08:56 UTC

README

Latest Version on Packagist Software License Total Downloads

Install

Via Composer

$ composer require am2studio/laravel-admin-form

Register service provider in your app.php

AM2Studio\LaravelAdminForm\AdminFormServiceProvider::class,

Register the facade in your app.php

'AdminForm'  => AM2Studio\LaravelAdminForm\AdminFormFacade::class,

You can use default templates or if you want to use your own templates you can publish views and edit them

php artisan vendor:publish --provider="AM2Studio\LaravelAdminForm\AdminFormServiceProvider" --tag=views

Usage

Inside template:

{!! AdminForm::text($name, $value, $options) !!}

the list of helpers:

{!! AdminForm::text() !}}
{!! AdminForm::number() !}}
{!! AdminForm::radio() !}}
{!! AdminForm::password() !}}
{!! AdminForm::textarea() !}}
{!! AdminForm::select() !}}
{!! AdminForm::date() !}}
{!! AdminForm::checkbox() !}}
{!! AdminForm::submit() !}}

they all accept same parameters as Form:: helpers

There is another helper method

{!! AdminForm::row($label, $adminFormElement) !!}

example

{!! AdminForm::row(trans('ui.first_name'), AdminForm::text('first_name', $user->first_name)) !!}

this will render into

<tr>
    <td>First Name</td>
    <td>
        <div class="card-form">
            <fieldset class="no-inline-edit">
                <input placeholder="Enter first name here" name="first_name" type="text" value="Am2">
                <button data-js="submit-field" type="submit"><i class="fa fa-check"></i></button>
                <i class="fieldset-overlay" data-js="focus-on-field"></i>
            </fieldset>
        </div>
    </td>
</tr>

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

The MIT License (MIT). Please see License File for more information.