title: Laravel Validation with vue js
body: <p>i want to post ajax request using vue-resource <code>this.$http.post</code> request. it worked perfectly fine if i passed all validation rules but i want to get some validations if it fails. so far i keep getting 500 error if i don't fill out some input fields. it's hard for me to debug the error because it didn't appeared on the network tab.</p>
  
  <p>here's what i've done so far</p>
  
  <pre><code>//my modal component
  &lt;script&gt;
  export default {
      props: ['show'],
  
      data() {
          return {
              input: {
                  id: '',
                  name: '',
                  address: '',
                  email: ''
              },
              errorInputs: {}
          }
      },
  
      methods: {
          createStudent() {
              this.$http.post('/students', this.$data.input)
                  .then((response) =&gt; {
                 alert('added new row!)
              }, (response) =&gt; {
                  console.log(response.data);
              });
          }
        }
     }
  &lt;/script&gt;
  
  // my controller
  
  public function store(Request $request) {
      $validator = $this-&gt;validate($request,[
          'id' =&gt; 'required',
          'name' =&gt; 'required|unique:students',
          'email' =&gt; 'required|unique:students|email',
          'address' =&gt; 'required',
      ]);
  
      if($validator-&gt;passes()){
          Student::create($request-&gt;all());
  
          return response()-&gt;json([], 201);
      }
  
      $errors = json_decode($validator-&gt;errors());
  
      return response()-&gt;json([
          'success' =&gt; false,
          'message' =&gt; $errors
      ],422);
  }
  </code></pre>
  
  <p>any helps and references would be appreciated. i am using laravel 5.3 and vue js 2</p>