• Developer New

    Friday, March 24, 2017

    how to use Forms in laravel

    Form::open(['url' => 'foo/bar', 'method' => 'PUT']);
    Form::open(['route' => 'foo.bar']);
    Form::open(['route' => ['foo.bar', $parameter]]);
    Form::open(['action' => 'FooController@method']);
    Form::open(['action' => ['FooController@method', $parameter]]);
    Form::open(['url' => 'foo/bar', 'files' => true));
    Form::close();
    Form::token();
    Form::model($foo, ['route' => ['foo.bar', $foo->bar]]);
    Form Elements
    Form::label('id', 'Description');
    Form::label('id', 'Description', ['class' => 'foo']);
    Form::text('name');
    Form::text('name', $value);
    Form::text('name', $value, ['class' => 'name']);
    Form::textarea('name');
    Form::textarea('name', $value);
    Form::textarea('name', $value, ['class' => 'name']);
    Form::hidden('foo', $value);
    Form::password('password');
    Form::password('password', ['placeholder' => 'Password']);
    Form::email('name', $value, []);
    Form::file('name', ['class' => 'name']);
    Form::checkbox('name', 'value');
    // Generating a checkbox that is checkedForm::checkbox('name', 'value', true, ['class' => 'name']);
    Form::radio('name', 'value');
    // Generating a radio input that is selectedForm::radio('name', 'value', true, ['class' => 'name']);
    Form::select('name', ['key' => 'value']);
    Form::select('name', ['key' => 'value'], 'key', ['class' => 'name']);
    Form::submit('Submit!');
    Form::macro('fooField', function()
    {
        return '<input type="custom"/>';
    });
    Form::fooField();

    No comments:

    Post a Comment

    Fashion

    Beauty

    Travel