title: Laravel API REST for index() returns a json html string to the home page
body: <p>I'm using Laravel api with a resource controller.
  My api route</p>
  <pre><code>Route::apiResource('todos', TodoController::class)-&gt;middleware('auth:api');
  </code></pre>
  <p>Controller</p>
  <pre><code>public function index(TodoRequest $request): JsonResponse
  {
      $response = new Response();
  
      // $withDeleted = $request-&gt;has('withDeleted') ? true : false;
  
      $todos = $this-&gt;todoService-&gt;getAllTodosWithLists($request-&gt;query('withDeleted'));
  
      $response-&gt;setMessage(ServerMessages::TODOS_RETRIEVE_SUCCESS);
  
      return response()-&gt;json(
          $response-&gt;build($todos),
          $response-&gt;getCode($todos)
      );
  }
  </code></pre>
  <p>class TodoRequest extends FormRequest
  {</p>
  <pre><code>/**
   * Determine if the user is authorized to make this request.
   *
   * @return bool
   */
  public function authorize(): bool
  {
      return true;
  }
  
  /**
   * Get the validation rules that apply to the request.
   * Must match with FrontEnd fields
   *
   * @return array
   */
  public function rules(): array
  {
      return [
          'content' =&gt; 'required'
      ];
  }
  
  /**
   * Get custom messages for validator errors.
   *
   * @return array
   */
  public function messages(): array
  {
      return ['required' =&gt; 'The :attribute must not be left blanked.'];
  }
  </code></pre>
  <p>}</p>
  <p>My problem is everytime I add the <code>TodoRequest</code> in my parameter's it always return a response redirecting back to the default Laravel homepage.</p>
  <p>Note: I am passing a query parameter inside my <code>$request</code> i.e <code>withDeleted</code> and probably will add more filters. This app was originally made in Lumen which perfectly well, and I did some migration to the latest Laravel 9 framework.</p>