0

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();
     }

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.