title: accessing route prefix in app/providers
body: <p>i have a multi template website , i've created multiple folder for differetn templates in my views folder  ... but i have 1 admin template and i want to load admin section from that folder for all </p>
  
  <p>in my route i have something like </p>
  
  <pre><code>Route::group(['namespace' =&gt; 'Cp', 'prefix' =&gt; 'cp'  , 'middleware'=&gt;['admin' ,'auth'] ], function()
  {
  
      Route::get('/' ,  'IndexController@index' )-&gt;name('index_cp');
  });
  </code></pre>
  
  <p>in <code>app/providers/ViewServiceProvider.php</code> im changing template folder dynamically based on database stored value , but im trying to get the prefix of current route so if its <code>cp</code> it ignores the template folder and loads template from <code>cp</code> folder </p>
  
  <pre><code>    public function registerViewFinder()
      {
          $request = app(\Illuminate\Http\Request::class);
          dump($request-&gt;route()-&gt;getPrefix());
          if($request-&gt;route()-&gt;getPrefix() != 'cp')
          {
           // read from db &amp;  set the template folder 
          }
  
      }
  </code></pre>
  
  <p>im getting this error </p>
  
  <pre><code>Call to a member function getPrefix() on null
  </code></pre>
  
  <p>basically <code>$request-&gt;route()</code>  returns null </p>