Csrf form verification laravel error - php

when doing my laravel inscription form it work totally fine, suddenly i have an error with csrf verification form after adding verification email inscription controller, here is the error message:
TokenMismatchException in VerifyCsrfToken.php line 67:
Despite i put it in my forme like this:
#extends('index')
#section('content')
<div class="container">
</br>
<div class="row">
<div class="media service-box wow fadeInRight">
<div class="panel-heading">Insription</div>
<div class="panel-body">
<form id="form_inscription" name="form_inscription" class=" form-horizontal" role="form" method="POST" action="{{ url('/register') }}" onSubmit="return validate(this);">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }} has-feedback">
<label for="name" class="col-md-4 control-label">*Nom</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required >
</div>
#if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group {{ $errors->has('prenom') ? ' has-error' : '' }} has-feedback">
<label class="col-md-4 control-label">*Prénom</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" name="prenom" id="prenom" class="form-control" maxlength="30" value="{{ old('prenom') }}" required>
</div>
#if ($errors->has('prenom'))
<span class="help-block">
<strong>{{ $errors->first('prenom') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group {{ $errors->has('civilite') ? ' has-error' : '' }} has-feedback">
<label class="col-md-4 control-label">*Civilité</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<div style="float:left;margin-right:20%">
<label><input type="radio" name="civilite" id="civilite" class="form-control" style="height:20px;" value="1" data-bv-field="Type_Client" value="{{ old('civilite') }}" required>Entreprise
</label>
</div>
#if ($errors->has('civilite'))
<span class="help-block">
<strong>{{ $errors->first('civilite') }}</strong>
</span>
#endif
<div style="float:left">
<label><input type="radio" name="Type_Client" id="Type_Client" class="form-control" style="height:20px;" disabled="disabled" value="0" data-bv-field="Type_Client" value="{{ old('civilite') }}"><i class="form-control-feedback" data-bv-icon-for="Type_Client" style="display: none;"></i>Particulier</label>
</div>
</div>
</div>
</div>
<div class="form-group {{ $errors->has('adresse') ? ' has-error' : '' }} has-feedback">
<label class="col-md-4 control-label">*Adresse</label>
<div class="col-md-4 selectContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-map-marker"></i></span>
<input type="text" name="adresse" id="adresse" class="form-control" maxlength="120" autocomplete="off" data-bv-field="Adresse" value="{{ old('adresse') }}" required><i class="form-control-feedback" data-bv-icon-for="Adresse" style="display: none;"></i>
</div>
#if ($errors->has('adresse'))
<span class="help-block">
<strong>{{ $errors->first('adresse') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group {{ $errors->has('ville') ? ' has-error' : '' }} has-feedback">
<label class="col-md-4 control-label">*Ville</label>
<div class="col-md-4 selectContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
<input type="text" name="ville" id="ville" class="form-control" maxlength="50" autocomplete="off" data-bv-field="Ville" value="{{ old('ville') }}" required ><i class="form-control-feedback" data-bv-icon-for="Ville" style="display: none;"></i>
</div>
#if ($errors->has('ville'))
<span class="help-block">
<strong>{{ $errors->first('ville') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group {{ $errors->has('wilaya') ? ' has-error' : '' }} has-feedback">
<label class="col-md-4 control-label">*Téléphone FixeWilaya</label>
<div class="col-md-4 selectContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span>
<select name="wilaya" id="wilaya" class="form-control selectpicker" data-bv-field="wilaya"><option value="{{ old('wilaya') }}">Sélectionner une Wilaya</option><option value="1">Adrar</option><option value="2">Chlef</option><option value="3">Laghouat</option><option value="4">Oum El-Bouaghi</option><option value="5">Batna</option><option value="6">Bejaia</option><option value="7">Biskra</option><option value="8">Bechar</option><option value="9">Blida</option><option value="10">Bouira</option><option value="11">Tamanrassat</option><option value="12">Tebessa</option><option value="13">Tlemcen</option><option value="14">Tiaret</option><option value="15">Tizi-Ouzou</option><option value="16">Alger</option><option value="17">Djelfa</option><option value="18">Jijel</option><option value="19">Setif</option><option value="20">Saida</option><option value="21">Skikda</option><option value="22">Sidi-Bel-Abbes</option><option value="23">Annaba</option><option value="24">Guelma</option><option value="25">Constantine</option><option value="26">Médea</option><option value="27">Mostaganem</option><option value="28">M'sila</option><option value="29">Mascara</option><option value="30">Ouargla</option><option value="31">Oran</option><option value="32">El-Bayadh</option><option value="33">Illizi</option><option value="34">Bordj Bou-Arreridj</option><option value="35">Boumerdes</option><option value="36">El-Taref</option><option value="37">Tindouf</option><option value="38">Tissimsilt</option><option value="39">El-Oued</option><option value="40">khenchela</option><option value="41">Souk Ahras</option><option value="42">Tipaza</option><option value="43">Mila</option><option value="44">Ain Defla</option><option value="45">Naama</option><option value="46">Ain Timouchent</option><option value="47">Ghardaia</option><option value="48">Relizane</option></select><i class="form-control-feedback" data-bv-icon-for="Wilaya" style="display: none;"></i></div><small data-bv-validator="notEmpty" data-bv-validator-for="Wilaya" class="help-block" style="display: none;">Veuillez choisir votre Wilaya</small>
#if ($errors->has('wilaya'))
<span class="help-block">
<strong>{{ $errors->first('wilaya') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group {{ $errors->has('tel_mobile') ? ' has-error' : '' }} has-feedback">
<label class="col-md-4 control-label">*Mobile</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
<input id="tel_mobile" name="tel_mobile" class="form-control" maxlength="10" required >
</div>
#if ($errors->has('tel_mobile'))
<span class="help-block">
<strong>{{ $errors->first('tel_mobile') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group {{ $errors->has('tel_fix') ? ' has-error' : '' }} has-feedback">
<label class="col-md-4 control-label">*Téléphone Fixe</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
<input name="tel_fix" id="tel_fix" class="form-control" maxlength="9" autocomplete="off" data-bv-field="Fixe" value="{{ old('tel_fix') }}" required><i class="form-control-feedback" data-bv-icon-for="Fixe" style="display: none;"></i>
</div>
#if ($errors->has('tel_fix'))
<span class="help-block">
<strong>{{ $errors->first('tel_fix') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }} has-feedback">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon fa fa-at"></i>
</span>
<input id="email" type="email" class="form-control" required name="email" value="{{ old('email') }}">
</div>
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group has-feedback">
<label class="col-md-4 control-label">* Confirmer votre E-Mail</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon fa fa-at"></i>
</span>
<input type="email" name="Email2" id="Email2" class="form-control" maxlength="50" autocomplete="off" data-bv-field="Email2" required><i class="form-control-feedback" data-bv-icon-for="Email2" style="display: none;"></i>
</div>
<small data-bv-validator="notEmpty" data-bv-validator-for="Email2" class="help-block" style="display: none;">Veuillez retaper votre adresse Email</small><small data-bv-validator="emailAddress" data-bv-validator-for="Email2" class="help-block" style="display: none;">Veuillez saisir une adresse Email valide</small><small data-bv-validator="identical" data-bv-validator-for="Email2" class="help-block" style="display: none;">votre adresse Email n'est pas identique</small><small data-bv-validator="stringLength" data-bv-validator-for="Email2" class="help-block" style="display: none;">valeur non valide
</small>
</div>
</div>
<script>
document.getElementById("Email2").onpaste = function () {
alert("Merci de ne pas copier/coller"); // on prévient
return false; // on empêche
}
</script>
<div class="form-group {{ $errors->has('compte_banquaire') ? ' has-error' : '' }} has-feedback">
<label class="col-md-4 control-label">*Code Postale</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-eur"></i></span>
<input type="text" name="compte_banquaire" id="compte_banquaire" class="form-control" maxlength="5" data-bv-field="Code_Postal" value="{{ old('compte_banquaire') }}" required><i class="form-control-feedback" data-bv-icon-for="Code_Postal" style="display: none;"></i>
</div>
#if ($errors->has('compte_banquaire'))
<span class="help-block">
<strong>{{ $errors->first('compte_banquaire') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group {{ $errors->has('organisation') ? ' has-error' : '' }} has-feedback">
<label class="col-md-4 control-label">*Organisation</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-registration-mark"></i></span>
<input type="text" name="organisation" id="organisation" class="form-control" maxlength="20" data-bv-field="Organisation" value="{{ old('organisation') }}" required>
</div>
#if ($errors->has('organisation'))
<span class="help-block">
<strong>{{ $errors->first('organisation') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }} has-feedback">
<label for="password" class="col-md-4 control-label"> *Mot de pass</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input id="password" type="password" class="form-control" name="password" required>
</div>
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }} has-feedback">
<label for="password-confirm" class="col-md-4 control-label">*Confirmer mot de pass</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
#if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
<i class="fa fa-btn fa-user"></i> Creer compte
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
#endsection
Thank You for helping me.

Try this code
Replace
{{ csrf_field() }}
this one
<input type="hidden" name="_token" value="{{ csrf_token() }}">
or
<input type="hidden" name="_token" id="token" value="<?php echo csrf_token(); ?>">

Try
{!! csrf_field() !!} instead of {{ csrf_field() }}
checkout my answer here that user was also facing the same issue and the solution worked for him.

Related

how can i get the values of some inputs from database after select option in dropdown

I'm building an HTML form that contains all information about clients, and the others information, so I would when I choose the name of the client that is in the dropdown (select options that contain all name of clients ) the other input fields like (address, tel, email) should be filled automatically.
I don't know what I have to use ajax or jquery and how to use it.
this is my view:
#extends('layouts.master')
#section('content')
<div class="container">
<div class="row">
<div class="col-md-11">
<div class="panel panel-default">
<div class="panel-heading">Création de commandes</div>
<div class="panel-body">
<form id="form2" class="form-horizontal" method="POST" action="{{url('gestion_commandes/create')}}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('nomp') ? ' has-error' : '' }}">
<label for="nomp" class="col-md-1 control-label">Client</label>
<div class="col-md-5">
<select name="nomclient" id="nomclient" class="form-control dynamic" data-dependent="organisme" required autofocus>
<option>--Select--</option>
#foreach ($clientscombos as $clientcombos)
<option value="{{$clientcombos->nom}}">{{$clientcombos->nom}} </option>
#endforeach
</select>
</div>
{{ csrf_field() }}
<label for="organisme" class="col-md-1 control-label">Organisme</label>
<div class="col-md-5">
<input id="organisme" type="text" class="form-control" name="organisme" value="{{$clientcombos->organisme}}" required autofocus>
#if ($errors->has('organisme'))
<span class="help-block">
<strong>{{ $errors->first('organisme') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('adresse') ? ' has-error' : '' }}">
<label for="adresse" class="col-md-1 control-label">Adresse</label>
<div class="col-md-5">
<input id="adresse" type="text" class="form-control" name="adresse" value="{{$clientcombos->adresse}}" autofocus>
#if ($errors->has('adresse'))
<span class="help-block">
<strong>{{ $errors->first('adresse') }}</strong>
</span>
#endif
</div>
<label for="emailp" class="col-md-1 control-label">E-Mail Address</label>
<div class="col-md-5">
<input id="emailp" type="email" class="form-control" name="emailp" placeholder="Saisir l'adresse email" required autofocus>
#if ($errors->has('emailp'))
<span class="help-block">
<strong>{{ $errors->first('emailp') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('adressep') ? ' has-error' : '' }}">
<label for="tel" class="col-md-1 control-label">Tel</label>
<div class="col-md-3">
<input id="tel" type="Tel" class="form-control" name="tel" value="{{$clientcombos->tel1}}" required autofocus>
#if ($errors->has('tel'))
<span class="help-block">
<strong>{{ $errors->first('tel') }}</strong>
</span>
#endif
</div>
<label for="tel2p" class="col-md-1 control-label">Tel2</label>
<div class="col-md-3">
<input id="tel2p" type="Tel" class="form-control" name="tel2p" value="+2126" required autofocus>
#if ($errors->has('tel2p'))
<span class="help-block">
<strong>{{ $errors->first('tel2p') }}</strong>
</span>
#endif
</div>
<label for="faxp" class="col-md-1 control-label">Fax</label>
<div class="col-md-3">
<input id="faxp" type="Tel" class="form-control" name="faxp" value="{{$clientcombos->fax}}" required autofocus>
#if ($errors->has('faxp'))
<span class="help-block">
<strong>{{ $errors->first('faxp') }}</strong>
</span>
#endif
</div>
</div>
<div class=" panel panel-success"> </div>
<div class=" panel panel-success"> </div>
<div class="form-group{{ $errors->has('daterecep') ? ' has-error' : '' }}">
<label for="commercial" class="col-md-1 control-label">Commercial</label>
<div class="col-md-3">
<select name="commercial" id="commercial" class="form-control" required autofocus>
<option>--Select--</option>
#foreach ($combocommerciaux as $combocommercial)
<option value="{{$combocommercial->name}}">{{$combocommercial->name}} </option>
#endforeach
</select>
</div>
<label for="datereception" class="col-md-1 control-label">Date de réception</label>
<div class="col-md-3">
<input id="datereception" type="date" class="form-control" name="datereception" placeholder="Saisir le nom complet" required autofocus>
#if ($errors->has('datereception'))
<span class="help-block">
<strong>{{ $errors->first('datereception') }}</strong>
</span>
#endif
</div>
<label for="dateprelev" class="col-md-1 control-label">Date de prélevement</label>
<div class="col-md-3">
<input id="dateprelev" type="date" class="form-control" name="dateprelev" placeholder="Saisir le nom complet" required autofocus>
#if ($errors->has('dateprelev'))
<span class="help-block">
<strong>{{ $errors->first('dateprelev') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('commercial') ? ' has-error' : '' }}">
<label for="savedby" class="col-md-9 control-label">Enregistrée par </label>
<div class="col-md-3">
<input id="savedby" type="text" class="form-control" name="savedby" value="{{Auth::user()->name}}" required autofocus>
#if ($errors->has('savedby'))
<span class="help-block">
<strong>{{ $errors->first('savedby') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('nbrrowsol') ? ' has-error' : '' }}">
<label for="nbrrowsow" class="col-md-1 control-label">Sol </label>
<div class="col-md-3">
<input id="nbrrowsol" type="number" class="form-control" name="nbrrowsol" required autofocus>
#if ($errors->has('nbrrowsol'))
<span class="help-block">
<strong>{{ $errors->first('nbrrowsol') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('nbrroweau') ? ' has-error' : '' }}">
<label for="nbrroweau" class="col-md-1 control-label">Eau </label>
<div class="col-md-3">
<input id="nbrroweau" type="number" class="form-control" name="nbrroweau" required autofocus>
#if ($errors->has('nbrroweau'))
<span class="help-block">
<strong>{{ $errors->first('nbrroweau') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('nbrrowveg') ? ' has-error' : '' }}">
<label for="nbrrowveg" class="col-md-1 control-label">VEG </label>
<div class="col-md-3">
<input id="nbrrowveg" type="number" class="form-control" name="nbrrowveg" required autofocus>
#if ($errors->has('nbrrowveg'))
<span class="help-block">
<strong>{{ $errors->first('nbrrowveg') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('nbrrowbiof') ? ' has-error' : '' }}">
<label for="nbrrowbiof" class="col-md-1 control-label">Fertilisant </label>
<div class="col-md-3">
<input id="nbrrowbiof" type="number" class="form-control" name="nbrrowbiof" placeholder="Saisir l'adresse email" required autofocus>
#if ($errors->has('nbrrowbiof'))
<span class="help-block">
<strong>{{ $errors->first('nbrrowbiof') }}</strong>
</span>
#endif
</div>
<div class="col-md-6 control-label">
<button type="submit" class="btn btn-primary" onclick="location.href='{{url('gestion_regions/create')}}'" >Executer</button>
</div>
</div>
<div class="form-group{{ $errors->has('nbrrowmicair') ? ' has-error' : '' }}">
<label for="nbrrowmicair" class="col-md-1 control-label">Mic Air </label>
<div class="col-md-3">
<input id="nbrrowmicair" type="number" class="form-control" name="nbrrowmicair" required autofocus>
#if ($errors->has('nbrrowmicair'))
<span class="help-block">
<strong>{{ $errors->first('nbrrowmicair') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('nbrrowmiceau') ? ' has-error' : '' }}">
<label for="nbrrowmiceau" class="col-md-1 control-label">Mic Eau</label>
<div class="col-md-3">
<input id="nbrrowmiceau" type="number" class="form-control" name="nbrrowmiceau" required autofocus>
#if ($errors->has('nbrrowmiceau'))
<span class="help-block">
<strong>{{ $errors->first('nbrrowmiceau') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('nbrrowmicsurface') ? ' has-error' : '' }}">
<label for="nbrrowmicsurface" class="col-md-1 control-label">Mic Surface </label>
<div class="col-md-3">
<input id="nbrrowmicsurface" type="number" class="form-control" name="nbrrowmicsurface" placeholder="Saisir l'adresse email" required autofocus>
#if ($errors->has('nbrrowmicsurface'))
<span class="help-block">
<strong>{{ $errors->first('nbrrowmicsurface') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-success">
Enregistrer
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
this is controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use App\Client;
class DynamicDependent extends Controller
{
public function comboboxclients()
{
$clientscombos = DB::select('select * from clients');
$combocommerciaux = DB::select('select * from commercials');
return view('gestion_commandes.create',['clientscombos' => $clientscombos , 'combocommerciaux' => $combocommerciaux]);
}
}
You have to:
1) Server-side: create another action which will fetch client data based on value from select(I suggest you using an client id as select value inside your template).
2) Client-side: add hook on select value change('change' event inside JS), which will send an AJAX request(containing selected value) to action created on step 1, and populate form inputs with received data.
That's pretty much it. Fell free to ask about specific implementation details, but keep in mind that no one will write code for you here, you have to do it yourself, but you'll be fine with this directions.

save() method only writing last record in my form

I'm trying to save multiple form records in my database, but it is only writing last record in my blade loop.
//This is my loop in blade. for getting multiple informations
#for ($i = 1; $i < $package->package_for + 1; $i++)
#for ($i = 1; $i < $package->package_for + 1; $i++)
<div class="container information">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading"><h3>Guest {{ $i }}</h3></div>
<div class="panel-body">
<form class="form-horizontal" action="{{ route('information', ['id' => $package->id]) }}" role="form" method="POST">
<div class="col-md-9 col-md-offset-2 fullname">
<div class="gender">
<label> &nbsp</label>
<select type="text" id="gender" class="form-control col-md-1" name="gender" required>
<option value="1">Mr</option>
<option value="2">Mrs</option>
</select>
</div>
<div class="form-group{{ $errors->has('firstname') ? ' has-error' : '' }}">
<label> First Name</label>
<input id="firstname" placeholder="First Name" type="text" class="form-control" name="firstname" required>
#if ($errors->has('firstname'))
<span class="help-block">
<strong>{{ $errors->first('firstname') }}</strong>
</span>
#endif
</div>
<div class="form-group{{ $errors->has('lastname') ? ' has-error' : '' }}">
<label> First Name</label>
<input id="lastname" placeholder="Last Name" type="text" class="form-control" name="lastname" required>
#if ($errors->has('lastname'))
<span class="help-block">
<strong>{{ $errors->first('lastname') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('contact_number') ? ' has-error' : '' }}">
<label for="contact_number" class="col-md-4 control-label">&nbsp</label>
<div class="col-md-6">
<label>Contact Number</label>
<input id="contact_number_number" placeholder="Contact Number" type="contact_number" class="form-control" name="contact_number" required>
#if ($errors->has('contact_number'))
<span class="help-block">
<strong>{{ $errors->first('contact_number') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('age') ? ' has-error' : '' }}">
<label for="age" class="col-md-4 control-label">&nbsp</label>
<div class="col-md-6">
<label>Age</label>
<select type="text" id="age" class="form-control col-md-1" name="age" required>
#for ($b = 1; $b < 50; $b++)
<option value="$i">{!! $b !!}</option>
#endfor
</select>
#if ($errors->has('age'))
<span class="help-block">
<strong>{{ $errors->first('age') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('address') ? ' has-error' : '' }}">
<label for="address" class="col-md-4 control-label">&nbsp</label>
<div class="col-md-6">
<label>Address</label>
<input id="address" placeholder="Address" type="address" class="form-control" name="address" value="{{ old('address') }}" required>
#if ($errors->has('address'))
<span class="help-block">
<strong>{{ $errors->first('address') }}</strong>
</span>
#endif
</div>
</div>
</div>
</div>
</div>
</div>
</div>
#endfor
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary" href="{{ route('package.addToCart', ['id' => $package->id]) }}">
Book Package
</button>
{{ csrf_field() }}
</div>
</div>
</form>

Laravel 5.3 Session store not set on request

I have a Laravel project and I'm getting the following error and tried other questions asked before but i can't understand the problem. plz anybody guide me.
RuntimeException in C:\xampp\htdocs\project\vendor\laravel\framework\src\Illuminate\Http\Request.php line 905:
My routes.php file is here:
Route::group(['middleware' => ['web']], function () {
// default public route
Route::get('/', 'DashboardController#index');
// Rediret for Login Page
Route::get('/loginmsg', 'LoginMessageController#index');
// dashboard route
Route::get('dashboard/index', 'DashboardController#index');
});
//Route::get('/service/get/login','App\Http\Controllers\Auth\LoginMessageController#index')->name('xyz');
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::get('register', 'DashboardController#index');
});
Here's my register.blade.php
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Register</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-4 control-label">Name</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}">
#if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}">
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password">
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation">
#if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
<i class="fa fa-btn fa-user"></i> Register
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection

Validation is not working on Registration & Login form

I've following this Blog for multi table authentication. I downloaded the project as it is and run the project. Everything works but validation is not working. Now message showing while I post an empty form.
Here is the code:
<form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">Name</label>
<div class="col-md-6">
<input type="text" class="form-control" name="name" value="{{ old('name') }}">
#if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input type="password" class="form-control" name="password">
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-6">
<input type="password" class="form-control" name="password_confirmation">
#if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
<i class="fa fa-btn fa-user"></i>Register
</button>
</div>
</div>
</form>
According to the code error should be shown. I don't understand why its not working.
There is no validation rules or incorrect validation rules in your post controller.

Laravel 5.2: How to add a register page?

I am using Laravel 5.2,
and I use php artisan make:auth to make register page and login page.
Now, I would want to make two separated register pages,which used by two roles,seller and buyer ,
the two register pages named seller-register.blade.php and buyer-register.blade.php,
in view,add a item named userType,respectively corresponding seller and buyer,like this:
seller-register.blade.php
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Register</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/seller-register') }}">
{!! csrf_field() !!}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">Name</label>
<div class="col-md-6">
<input type="text" class="form-control" name="name" value="{{ old('name') }}">
#if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<label class="col-md-4 form-control-label">User Type</label>
<div class="col-md-6">
<label class="c-input c-radio">
<input id="userType" name="userType" type="radio" value="1" checked>
<span class="c-indicator"></span>
seller
</label>
</div>
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input type="password" class="form-control" name="password">
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-6">
<input type="password" class="form-control" name="password_confirmation">
#if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
<i class="fa fa-btn fa-user"></i>Register
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
Question:
How to modify controller and other something?

Categories