Categories

Thursday, June 13, 2024
#919814419350 therichposts@gmail.com
LaravelPhp

Laravel Collective Package Form Layouts Examples Code

Laravel 7.2 routing with route group auth guard check with prefix

Laravel Collective Package Form Layouts Examples Code

Hello to all, welcome to therichpost.com. In this post, I will tell you, Laravel Collective Package Form Layouts Examples Code. I am doing with laravel first time in my website. Laravel is one of the top php mvc framework.

1. First you need to write below code into your composer:

composer require “laravelcollective/html”:”^5.3.0″

2. Second you need to write below code into providers array of config/app.php file:

‘providers’ => [
// …
Collective\Html\HtmlServiceProvider::class,
// …
],

3. Third you need to write below code into aliases array of config/app.php file:

‘aliases’ => [
// …
‘Form’ => Collective\Html\FormFacade::class,
‘Html’ => Collective\Html\HtmlFacade::class,
// …
],

With this laravelcollective package, you can use form short code easily and I will show you some examples code:

1. Here is the laravelcollective package Form code for Sign-In page with Bootstrap structure and you can use this into your laravel blade template:

<div class=”container”>
<div class=”row”>
<div class=”col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2″>

<div class=”signin-from”>
<h3>Sign In</h3>
{!! Form::open([‘method’ => ‘post’, ‘class’ => ‘form’, ‘id’ => ‘signinfrom’]) !!}

<div class=”form-group”>
{!! Form::label(’email’, ‘E-Mail Address’) !!}
{!! Form::text(’email’, ”, [‘class’ => ‘form-control’]) !!}
{!! $errors->first(’email’,'<span class=”help-block”>:message</span>’) !!}
</div>
<div class=”form-group”>
{!! Form::label(‘password’, ‘Password’) !!}
{!! Form::password(‘password’, [‘class’ => ‘form-control’]) !!}
{!! $errors->first(‘password’,'<span class=”help-block”>:message</span>’) !!}
</div>

<div class=”checkbox”>
<label>
{!! Form::checkbox(‘rememberMe’, ‘ON’, [‘class’ => ‘form-control’]) !!} Remember Me
</label>
</div>
<a href=”#”>Forgot Password?</a>
{!! Form::submit(‘Sign In’, [‘class’=>’btn btn-primary-outline pull-right’]) !!}
<div class=”clearfix”></div>
{!! Form::close() !!}
</div>
</div>
</div>
</div>

2. Here is the laravelcollective package Form code for Sign-Up page with Bootstrap structure and you can use this into your laravel blade template:

<div class=”container”>
<div class=”row”>
<div class=”col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2″>
<div class=”signup-from”>
<h3>Sign Up</h3>
{!! Form::open([‘url’ => ‘signup’, ‘method’ => ‘post’, ‘class’ => ‘form’, ‘id’ => ‘signupfrom’]) !!}
<div class=”form-group”>
{!! Form::label(‘first_name’, ‘First Name’) !!}
{!! Form::text(‘first_name’, ”, [‘class’ => ‘form-control’]) !!}

</div>
<div class=”form-group”>
{!! Form::label(‘last_name’, ‘Last Name’) !!}
{!! Form::text(‘last_name’, ”, [‘class’ => ‘form-control’]) !!}

</div>
<div class=”form-group”>
{!! Form::label(’email’, ‘E-Mail Address’) !!}
{!! Form::text(’email’, ”, [‘class’ => ‘form-control’]) !!}

</div>
<div class=”form-group”>
{!! Form::label(‘password’, ‘Password’) !!}
{!! Form::password(‘password’, [‘class’ => ‘form-control’]) !!}

</div>
<div class=”form-group”>
{!! Form::label(‘re_password’, ‘Confirm Password’) !!}
{!! Form::password(‘re_password’, [‘class’ => ‘form-control’]) !!}

</div>
<div class=”form-group”>
{!! Form::label(‘phone_no’, ‘Phone No’) !!}
{!! Form::text(‘phone_no’, ”, [‘class’ => ‘form-control’]) !!}

</div>
<div class=”form-group”>
{!! Form::label(‘birthday’, ‘Date of Birth’) !!}
{!! Form::text(‘birthday’, ”, [‘class’ => ‘form-control ll-skin-melon’, ‘id’=>’datepicker’]) !!}

</div>

{!! Form::submit(‘Sign Up’, [‘class’=>’btn btn-primary-outline’]) !!}
{!! Form::close() !!}
</div>
</div>
</div>
</div>

There are so many code tricks in laravel and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.