title: How can I use Laravel Validation in the API, it's returning my view now?
body: <p>I have this route in <strong>route/api.php</strong>:</p>
  
  <p><code>Route::post('/register', 'LoginController@register');</code></p>
  
  <p>My <strong>LoginController</strong></p>
  
  <pre><code>class LoginController extends Controller {
  
  public function register(Request $request) {
      $this-&gt;validate($request, // &lt;-- using this will return the view
        // from **web.php** instead of the expected json response.
      [
          'email' =&gt; 'required|email',
          'firstName' =&gt; 'required|alpha_dash',
          'lastName' =&gt; 'required',
          'password' =&gt; 'required|confirmed',
      ]);
  
      $input = $request-&gt;all();
      //$plain_password = $input['password'];
      $input['uuid'] = uuid();
      $input['password'] = Hash::make($input['password']);
  
      $user = User::create($input);
  
      dd($errors);
  
      $response['succes'] = true;
      $response['user'] = $user;
      return response($response);
      }
  }
  </code></pre>
  
  <p>Why does adding a validation call change the behaviour to returning my view / the wrong route. I want the api to validate my request too, not just my "frontend".</p>