Reputation: 873
This is my Laravel validation. What I want to do is if input vtype =='s' I want to send an error custom error message to show in the form. How can I do That
Validator::make($request->all(), [
'date' => 'required|date|'
])->validate();
if($request->input('vtype')==='s'){
return Redirect::back();
}
elseif($request->input('piklocation')==='A'){
return Redirect::back();
}
Upvotes: 0
Views: 56
Reputation: 14248
You can do with flash session data, like this:
return Redirect::back()->with('error', 'Error message');
then in your view:
@if($error)
<p> {{ $error }} </p>
@endif
Upvotes: 1