大家好,我有一个问题要保留模式显示,错误显示,但是我必须单击一个按钮以查看错误的详细信息,因为当我单击提交按钮时,模式消失了,在那里保留模式显示的任何想法没有点击返回按钮添加错误,请帮助我
这是我的模态Blade.php
<div class="modal fade" id="add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header bg-primary">
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>-->
<h4 class="modal-title" id="myModalLabel"><b>Ajouter Fournisseur </b></h4>
</div>
<form action="{{ route('addFournisseur') }}" method="post" id="Register">
{{csrf_field()}}
<div class="modal-body bgColorWhite">
<div class="form-group has-feedback">
<label for="nom">Nom :</label>
<input type="text" class="form-control" name="nom" id="nom" required placeholder="Entrer nom" value="{{old('nom')}}">
<span class="glyphicon glyphicon-user form-control-feedback"></span>
<p style="color:red;"><span style="color:red;" class="help-block">{{ $errors->first('nom', ':message') }}</span></p>
</div>
<div class="form-group has-feedback">
<label for="email">Email :</label>
<input type="email" class="form-control" name="email" id="email" required placeholder="Entrer email" value="{{old('email')}}">
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
<p style="color:red;"><span style="color:red;" class="help-block">{{ $errors->first('email', ':message') }}</span></p>
</div>
<div class="form-group has-feedback">
<label for="telephone">Téléphone :</label>
<input type="phoneNumber" class="form-control" name="telephone" id="telephone" required placeholder="Entrer numéro téléphone" value="{{old('telephone')}}">
<span class="glyphicon glyphicon-phone form-control-feedback"></span>
<p style="color:red;"><span style="color:red;" class="help-block">{{ $errors->first('telephone', ':message') }}</span></p>
</div>
<div class="form-group has-feedback">
<label for="fax">Fax :</label>
<input type="phoneNumber" class="form-control" name="fax" id="fax" placeholder="Entrer Fax : optionnel" value="{{old('fax')}}">
<span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
<p style="color:red;"><span style="color:red;" class="help-block">{{ $errors->first('fax', ':message') }}</span></p>
</div>
<div class="form-group has-feedback">
<label for="ville">Ville :</label>
<input type="text" class="form-control" name="ville" id="ville" required placeholder="Entrer ville" value="{{old('ville')}}">
<span class="glyphicon glyphicon-globe form-control-feedback"></span>
<p style="color:red;"><span style="color:red;" class="help-block">{{ $errors->first('ville', ':message') }}</span></p>
</div>
<div class="form-group has-feedback">
<label for="adresse1">Adresse :</label>
<input type="textarea" class="form-control" name="adresse1" id="adresse1" required placeholder="Entrer adresse" value="{{old('adresse1')}}">
<span class="glyphicon glyphicon-map-marker form-control-feedback"></span>
<p style="color:red;"><span style="color:red;" class="help-block">{{ $errors->first('adresse1', ':message') }}</span></p>
</div>
<div class="form-group has-feedback">
<label for="adresse2">Adresse 2 :</label>
<input type="textarea" class="form-control" name="adresse2" id="adresse2" placeholder="Entrer 2éme adresse : optionnel " value="{{old('adresse2')}}" >
<span class="glyphicon glyphicon-map-marker form-control-feedback"></span>
<p style="color:red;"><span style="color:red;" class="help-block">{{ $errors->first('adresse2', ':message') }}</span></p>
</div>
</div>
<div class="modal-footer bg-info">
<button type="button" class="btn btn-secondary" onclick="javascript:window.location.reload()" data-dismiss="modal" ><span class="glyphicon glyphicon-remove"></span> Fermer</button>
<button type="submit" onclick="javascript:window.location.reload()" class="btn btn-primary" ><span class="glyphicon glyphicon-log-in"></span> Enregistrer</button>
</div>
</form>
</div>
</div>
</div>
这是我的习惯请求FournisseurRequest.php
public function rules()
{
return [
'nom' => 'required|min:2|max:25',
'email' => 'required|unique:fournisseurs|email',
'telephone' => 'required|unique:fournisseurs|numeric',
'fax' => 'unique:fournisseurs|max:25|numeric',
'ville' => 'required|string|min:3|max:10',
'adresse1' => 'required|string|min:2|max:100',
'adresse2' => 'max:100'
];
}
这是我的控制器
public function addFournisseur(FournisseurRequest $request)
{
Fournisseur::create($request->all());
Session::flash('message','le Fournisseur '.$request->nom.' a été crée avec succès');
return back();
}
这是我的路线
Route::POST('/addFournisseur','FournisseurController@addFournisseur')->name('addFournisseur');