title: How do i override a Laravel Nova controller?
body: <p>Because Laravel Nova global search ignores policies, i want to override it's controller. Somehow this doesn't work and the global search defaults to <code>Laravel\Nova\Http\Controllers\SearchController</code>.</p>
  
  <p>What i have so far:</p>
  
  <p><code>app/config.php</code></p>
  
  <pre class="lang-php prettyprint-override"><code>
      //..
      'providers' =&gt; [
  
          //..
          App\Providers\RouteServiceProvider::class,
          App\Providers\NovaServiceProvider::class,
         //..
      ],
  
  </code></pre>
  
  <p>(please note the order of the providers)</p>
  
  <p><code>routes/web.php</code></p>
  
  <pre class="lang-php prettyprint-override"><code>//..
  Route::get('nova-api/search', 'SearchController@index');
  </code></pre>
  
  <p><code>app/Http/Controllers/SearchController.php</code></p>
  
  <pre class="lang-php prettyprint-override"><code>
  namespace App\Http\Controllers;
  
  use Laravel\Nova\Nova;
  use Laravel\Nova\GlobalSearch;
  use Laravel\Nova\Http\Requests\NovaRequest;
  use Laravel\Nova\Http\Controllers\SearchController as NovaSearchController;
  
  class SearchController extends NovaSearchController
  {
      /**
       * Get the global search results for the given query.
       *
       * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
       * @return \Illuminate\Http\Response
       */
      public function index(NovaRequest $request)
      {
          return (new GlobalSearch(
              $request, Nova::globallySearchableResources($request)
          ))-&gt;get();
      }
  }
  </code></pre>
  
  <p><strong>Versions</strong></p>
  
  <ul>
  <li>Laravel Version: 5.8.24 </li>
  <li>Nova Version: 2.0.6 </li>
  <li>PHP Version: 7.2.10</li>
  </ul>
  
  <p>This does not work. The route <code>nova-api/search</code> still points to <code>Laravel\Nova\Http\Controllers\SearchController</code>. What am i doing wrong?</p>