I've written a simple HTML code for a form:
Form code
<form method="POST" action="/ducks" novalidate>
<div class="form-group #if ($errors->has('name')) has-error #endif">
<label for="name">Name</label>
<input type="text" id="name" class="form-control" name="name" placeholder="Somebody Awesome" value="{{ Input::old('name') }}">
#if ($errors->has('name')) <p class="help-block">{{ $errors->first('name') }}</p> #endif
</div>
<div class="form-group #if ($errors->has('email')) has-error #endif">
<label for="email">Email</label>
<input type="text" id="email" class="form-control" name="email" placeholder="super#cool.com" value="{{ Input::old('email') }}">
#if ($errors->has('email')) <p class="help-block">{{ $errors->first('email') }}</p> #endif
</div>
<div class="form-group #if ($errors->has('password')) has-error #endif">
<label for="password">Password</label>
<input type="password" id="password" class="form-control" name="password">
#if ($errors->has('password')) <p class="help-block">{{ $errors->first('password') }}</p> #endif
</div>
<div class="form-group #if ($errors->has('password_confirm')) has-error #endif">
<label for="password_confirm">Confirm Password</label>
<input type="password" id="password_confirm" class="form-control" name="password_confirm">
#if ($errors->has('password_confirm')) <p class="help-block">{{ $errors->first('password_confirm') }}</p> #endif
</div>
<button type="submit" class="btn btn-success">Submit!</button>
</form>
php code
<?php
$formdata = Neo4j::makeNode();
$formdata->setProperty('frname', 'fname')
->setProperty('lsname', 'lname')
->setProperty('pname', 'pword')
->setProperty('mail','email')
->save();
$formdataId = $formdata->getId();
?>
And I've added a migration code as shown above. Controllers are good, I think so.
But the data isn't getting stored in neo4j DB. How can I fix it?
Related
Hello i'm building quiz system and i'm stuck on this problem.
Trying to save quiz but it's errors
<form action="/admin/quiz/store" method="POST">
#csrf
<div class="form-group">
<label for="title">ქვიზის დასახელება</label>
<input name="title[title]" type="text" class="form-control" value="{{ old('title.title') }}" id="title" placeholder="">
#error('title.title')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question2">ქვიზის შეკითხვა</label>
<input name="questions[1][question]" type="text" class="form-control" value="{{ old('questions.0.question') }}" id="question1" placeholder="">
#error('questions.0.question')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<fieldset>
<div>
<div class="form-group">
<label for="question1answer1">ქვიზის პასუხი</label>
<input name="questions[1][answers][]" type="text" class="form-control" value="{{ old('answers.0.answer') }}" id="question1answer1" aria-describedby="choicesHelp" placeholder="">
#error('answers.0.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question1answer2">ქვიზის პასუხი</label>
<input name="questions[1][answers][]" type="text" class="form-control" value="{{ old('answers.1.answer') }}" id="question1answer2" aria-describedby="choicesHelp" placeholder="">
#error('answers.1.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question1answer3">ქვიზის პასუხი</label>
<input name="questions[1][answers][]" type="text" class="form-control" value="{{ old('answers.2.answer') }}" id="question1answer3" aria-describedby="choicesHelp" placeholder="">
#error('answers.2.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question1answer4">ქვიზის პასუხი</label>
<input name="questions[1][answers][]" type="text" class="form-control" value="{{ old('answers.3.answer') }}" id="question1answer4" aria-describedby="choicesHelp" placeholder="">
#error('answers.3.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
</div>
</fieldset>
</div>
meore shekitxva
<div class="form-group">
<label for="question2">ქვიზის შეკითხვა</label>
<input name="questions[2][question]" type="text" class="form-control" value="{{ old('questions.0.question') }}" id="question2" placeholder="">
#error('questions.0.question')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<fieldset>
<div>
<div class="form-group">
<label for="question2answer1">ქვიზის პასუხი</label>
<input name="questions[2][answers][]" type="text" class="form-control" value="{{ old('answers.0.answer') }}" id="question2answer1" aria-describedby="choicesHelp" placeholder="">
#error('answers.0.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question2answer2">ქვიზის პასუხი</label>
<input name="questions[2][answers][]" type="text" class="form-control" value="{{ old('answers.1.answer') }}" id="question2answer2" aria-describedby="choicesHelp" placeholder="">
#error('answers.1.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question2answer3">ქვიზის პასუხი</label>
<input name="questions[2][answers][]" type="text" class="form-control" value="{{ old('answers.2.answer') }}" id="question2answer3" aria-describedby="choicesHelp" placeholder="">
#error('answers.2.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question2answer4">ქვიზის პასუხი</label>
<input name="questions[2][answers][]" type="text" class="form-control" value="{{ old('answers.3.answer') }}" id="question2answer4" aria-describedby="choicesHelp" placeholder="">
#error('answers.3.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
</div>
</fieldset>
</div>
<button type="submit" class="btn btn-primary">ქვიზის დამატება</button>
</form>
Its gives Undefined array key "answers" so i really don't understand why it's giving me this error...
I was creating like this answers[][answer] but it was saving quiz title and questions normal but in answers table it was saving first question answers in question_id=1 and question_id=2 and it's saves second question same.
Then someone told me to do questions[1][answers][] but now i'm getting Undefined array key "answers"
saving controller
public function store(Quizze $quizzes)
{
$data = request()->validate([
'title.title' => 'required',
'questions.*.question' => 'required',
'answers.*.answer' => 'required',
], [
'title.title.required' => 'გთხოვთ, შეიყვანოთ ქვიზის სახელი.',
'questions.*.question.required' => 'გთხოვთ, შეიყვანოთ შეკითხვა.',
'answers.*.answer.required' => 'გთხოვთ, შეიყვანოთ პასუხი.'
]);
$storeQuiz = $quizzes->create($data['title']);
foreach ($data['questions'] as $q) {
$question = $storeQuiz->questions()->create($q);
$question->answers()->createMany($data['answers']);
}
return redirect('admin/quizzes');
}
please can someone help me with this...
sorry for my bad english.
You need to update your loop :
foreach ($data['questions'] as $key => $q) {
$question = $storeQuiz->questions()->create(['question' => $q['question']]);
$question->answers()->createMany($data['questions'][$key]['answers']);
}
Update
There's no answers data (ref by comment), because validation. You need to change validation :
'title.title' => 'required',
'questions.*.question' => 'required',
'questions.*.answers.*.answer' => 'required',
And HTML :
<form action="/admin/quiz/store" method="POST">
#csrf
<div class="form-group">
<label for="title">ქვიზის დასახელება</label>
<input name="title[title]" type="text" class="form-control" value="{{ old('title.title') }}" id="title" placeholder="">
#error('title.title')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question2">ქვიზის შეკითხვა</label>
<input name="questions[1][question]" type="text" class="form-control" value="{{ old('questions.0.question') }}" id="question1" placeholder="">
#error('questions.0.question')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<fieldset>
<div>
<div class="form-group">
<label for="question1answer1">ქვიზის პასუხი</label>
<input name="questions[1][answers][][answer]" type="text" class="form-control" value="{{ old('questions.1.answers.0.answer') }}" id="question1answer1" aria-describedby="choicesHelp" placeholder="">
#error('questions.1.answers.0.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question1answer2">ქვიზის პასუხი</label>
<input name="questions[1][answers][][answer]" type="text" class="form-control" value="{{ old('questions.1.answers.1.answer') }}" id="question1answer2" aria-describedby="choicesHelp" placeholder="">
#error('questions.1.answers.1.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question1answer3">ქვიზის პასუხი</label>
<input name="questions[1][answers][][answer]" type="text" class="form-control" value="{{ old('questions.1.answers.2.answer') }}" id="question1answer3" aria-describedby="choicesHelp" placeholder="">
#error('questions.1.answers.2.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question1answer4">ქვიზის პასუხი</label>
<input name="questions[1][answers][][answer]" type="text" class="form-control" value="{{ old('questions.1.answers.3.answer') }}" id="question1answer4" aria-describedby="choicesHelp" placeholder="">
#error('questions.1.answers.3.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
</div>
</fieldset>
</div>
meore shekitxva
<div class="form-group">
<label for="question2">ქვიზის შეკითხვა</label>
<input name="questions[2][question]" type="text" class="form-control" value="{{ old('questions.0.question') }}" id="question2" placeholder="">
#error('questions.0.question')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<fieldset>
<div>
<div class="form-group">
<label for="question2answer1">ქვიზის პასუხი</label>
<input name="questions[2][answers][][answer]" type="text" class="form-control" value="{{ old('questions.2.answers.0.answer') }}" id="question2answer1" aria-describedby="choicesHelp" placeholder="">
#error('questions.2.answers.0.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question2answer2">ქვიზის პასუხი</label>
<input name="questions[2][answers][][answer]" type="text" class="form-control" value="{{ old('questions.2.answers.1.answer') }}" id="question2answer2" aria-describedby="choicesHelp" placeholder="">
#error('questions.2.answers.1.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question2answer3">ქვიზის პასუხი</label>
<input name="questions[2][answers][][answer]" type="text" class="form-control" value="{{ old('questions.2.answers.2.answer') }}" id="question2answer3" aria-describedby="choicesHelp" placeholder="">
#error('questions.2.answers.2.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
<div class="form-group">
<label for="question2answer4">ქვიზის პასუხი</label>
<input name="questions[2][answers][][answer]" type="text" class="form-control" value="{{ old('questions.2.answers.3.answer') }}" id="question2answer4" aria-describedby="choicesHelp" placeholder="">
#error('questions.2.answers.3.answer')
<small class="text-danger">{{ $message }}</small>
#enderror
</div>
</div>
</fieldset>
</div>
<button type="submit" class="btn btn-primary">ქვიზის დამატება</button>
</form>
I have a checkbox when i selected i have on database the value '1' but when i dont select i have this erreur
{SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'actif' cannot be null (SQL: insert into techniciens (user_id, actif, moyenne_avis, updated_at, created_at) values (6, , 30.555, 2018-03-14 09:07:15, 2018-03-14 09:07:15))}
create.blade.php
#extends('Layouts/app')
#extends('Layouts.master')
#section('content')
#if(count($errors))
<div class="alert alert-danger" role="alert">
<ul>
#foreach($errors ->all() as $message)
<li>{{$message}}</li>
#endforeach
</ul>
</div>
#endif
<div class="container">
<div class="row">
<div class="col-md-10">
<h1>Ajouter Technicien</h1>
<form action=" {{url ('technicien') }}" method="post">
{{csrf_field()}}
<div class="form-group">
<label for="">Nom</label>
<input id="nom" type="text" class="form-control" name="nom"
value="{{ old('nom')
}}" required autofocus>
#if ($errors->has('nom'))
<span class="help-block">
<strong>{{ $errors->first('nom') }}
</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="">Prenom</label>
<input id="prenom" type="text" class="form-control"
name="prenom" value="{{
old('prenom') }}" required autofocus>
#if ($errors->has('prenom'))
<span class="help-block">
<strong>{{ $errors->first('prenom') }}
</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="">Telephone</label>
<input id="tel" type="text" class="form-control" name="tel"
value="{{ old('tel') }}"
required autofocus>
#if ($errors->has('tel'))
<span class="help-block">
<strong>{{ $errors->first('tel') }}
</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="">Mobile</label>
<input id="mobil" type="text" class="form-control"
name="mobil" value="{{
old('mobil') }}" required autofocus>
#if ($errors->has('mobile'))
<span class="help-block">
<strong>{{ $errors->first('mobil') }}
</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="">Role</label>
<input id="role" type="text" class="form-control"
name="role" value="{{ old('role') }}"
required autofocus>
#if ($errors->has('role'))
<span class="help-block">
<strong>{{ $errors->first('role') }}
</strong>
</span>
#endif
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' :
'' }}">
<label for="">E-Mail Address</label>
<input id="email" type="text" class="form-control"
name="email" value="{{
old('email') }}" required autofocus>
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}
</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="password">Password</label>
<div class="form-group">
<input id="password" type="password"
class="form-control"
name="password" value="{{ old('password') }}" required autofocus>
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}
</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<label for="password">Confirm Password</label>
<div class="form-group">
<input id="password_confirmation"
type="password" class="form-control"
name="password" value="{{ old('password_confirmation') }}" required
autofocus>
</div>
</div>
<div class="form-group">
<label for="zoneintervention">zoneintervention</label>
<select multiple name="zoneintervention_id[]"
id="zoneintervention" class="form-
control" >
#foreach($zoneintervention as $zoneintervention)
<option value="{{ $zoneintervention->id }}">
{{$zoneintervention->code_postal}}
</option>
#endforeach
</select>
</div>
<div class="form-group">
<label for="">Moyenne Avis</label>
<input type="text" name ="moyenne_avis" class="form-
control"value="
{{old('moyenne_avis')}}">
</div>
<div class="form-group">
<div class="form-group">
<label for="">Etat</label>
<input type="checkbox" name ="actif" value="1">
</div>
</div>
<div class="form-group">
<input type="submit" value = "suivant" class="form-control
btn btn-primary">
</div>
</form>
</div>
</div>
#endsection
controler
public function create()
{
$zoneintervention = Zoneintervention::orderBy('id', 'desc')->get();
$metier = metier::orderBy('libelle_metier', 'desc')->get();
$tache = tache::orderBy('libelle_tache', 'desc')->get();
$user = user::orderBy('id', 'desc')->get();
return view('technicien.create')->with('zoneintervention',
$zoneintervention)->with('user',
$user);
}
/**
* Store a newly created resource in storage.
*
* #param
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$user = new user();
$user->nom = $request->input('nom');
$user->prenom = $request->input('prenom');
$user->tel = $request->input('tel');
$user->mobil = $request->input('mobil');
$user->role = $request->input('role');
$user->email = $request->input('email');
$user->password = $request->input('password');
$user->save();
$technicien = new technicien();
$technicien->user_id = $user->id;
$technicien->actif = $request->input('actif');
$technicien->moyenne_avis = $request->input('moyenne_avis');
$technicien->save();
$technicien->zoneintervention()->attach($request->zoneintervention_id);
return redirect('tarification/create');
}
route.php
Route::get('/technicien', 'TechnicienController#index');
Route::get('/technicien/create', 'TechnicienController#create');
Route::post('/technicien', 'TechnicienController#store');
Try to add hidden input with zero value, like this:
<input type="hidden" name="actif" value="0">
<input type="checkbox" name="actif" value="1">
So if checkbox is checked, then actif value will be 1, if checkbox is unchecked, then actif value will be 0, because then hidden value will be used.
Use $request->has()
$technicien = new technicien();
$technicien->user_id = $user->id;
if($request->has('actif')){
$technicien->actif = $request->input('actif');
}else{
$technicien->actif = 0;
}
$technicien->moyenne_avis = $request->input('moyenne_avis');
$technicien->save();
It's an SQLSTATE[23000] Integrity constraint violation error which occurs if the rules you declared in migration file doesn't matches with the input from your form. So in order to resolve this error you need to just add nullable() to your database migration file where you have 'actif' column declared in the up method.
$table->tinyInteger('actif')->nullable();
I have 2 table the first table user and the second technicien and the relation is one to one relation ship i like inserte the information of the user and the information of technicien in the same time
user model:
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
public function technicien()
{
return $this->hasOne('App\technicien');
}
use Notifiable;
/**
* The attributes that are mass assignable.
*
* #var array
*/
protected $fillable = [
'email', 'password','nom','prenom','tel','mobil','role',
];
/**
* The attributes that should be hidden for arrays.
*
* #var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
technicien model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class technicien extends Model
{
public function zoneintervention()
{
return $this->belongsToMany('App\zoneintervention','technicien_zone','technicien_id','zoneintervention_id');
}
public function metier()
{
return $this->belongsToMany('App\metier','technicien_metier','technicien_id','metier_id');
}
public function user()
{
return $this->belongsTo('App\User');
}
public function tarificationtache()
{
return $this->hasMany(Tarificationtache::class);
}
}
this is the view create.blade.php
#extends('Layouts/app')
#section('content')
#if(count($errors))
<div class="alert alert-danger" role="alert">
<ul>
#foreach($errors ->all() as $message)
<li>{{$message}}</li>
#endforeach
</ul>
</div>
#endif
<div class="container">
<div class="row"></div>
<div class="col-md-12">
<form action=" {{url ('technicien') }}" method="post">
{{csrf_field()}}
<div class="form-group">
<label for="">Nom</label>
<input id="nom" type="text" class="form-control" name="nom"
value="{{ old('nom') }}" required autofocus>
#if ($errors->has('nom'))
<span class="help-block">
<strong>{{ $errors->first('nom') }}
</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="">Prenom</label>
<input id="prenom" type="text" class="form-control"
name="prenom" value="{{ old('prenom') }}" required autofocus>
#if ($errors->has('prenom'))
<span class="help-block">
<strong>{{ $errors->first('prenom') }}
</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="">Telephone</label>
<input id="telephone" type="text" class="form-control"
name="telephone" value="{{ old('telephone') }}" required autofocus>
#if ($errors->has('telephone'))
<span class="help-block">
<strong>{{ $errors->first('telephone')
}}</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="">Mobile</label>
<input id="Mobile" type="text" class="form-control"
name="Mobile" value="{{ old('Mobile') }}" required autofocus>
#if ($errors->has('Mobile'))
<span class="help-block">
<strong>{{ $errors->first('Mobile') }}
</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="">Role</label>
<input id="role" type="text" class="form-control"
name="role" value="{{ old('role') }}" required autofocus>
#if ($errors->has('role'))
<span class="help-block">
<strong>{{ $errors->first('role') }}
</strong>
</span>
#endif
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' :
'' }}">
<label for="">E-Mail Address</label>
<input id="email" type="text" class="form-control"
name="email" value="{{ old('email') }}" required autofocus>
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}
</strong>
</span>
#endif
</div>
<div class="form-group">
<label for="password">Password</label>
<div class="form-group">
<input id="password" type="password"
class="form-control" name="password" value="{{ old('password') }}"
required
autofocus>
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}
</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<label for="password">Confirm Password</label>
<div class="form-group">
<input id="password_confirmation"
type="password_" class="form-control" name="password_confirmation"
value="{{
old('password_confirmation') }}" required s>
</div>
</div>
<div class="form-group">
<label for="zoneintervention">zoneintervention</label>
<select multiple name="zoneintervention_id[]"
id="zoneintervention" class="form-control" >
#foreach($zoneintervention as $zoneintervention)
<option value="{{ $zoneintervention->id }}">
{{$zoneintervention->code_postal}}
</option>
#endforeach
</select>
</div>
<div class="form-group">
<label for="">Moyenne Avis</label>
<input type="text" name ="moyenne_avis" class="form-
control"value="{{old('moyenne_avis')}}">
</div>
<div class="form-group">
<label for="">Etat</label>
<input type="text" name ="actif" class="form-
control"value="{{old('actif')}}">
</div>
<div class="form-group">
<input type="submit" value = "enregistrer" class="form-
control btn btn-primary">
</div>
</form>
</div>
</div>
#endsection
some one help me
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.
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.