title: Laravel two 404 styles
body: <p>I have a main site and an admin control panel. </p>
  
  <p>I want to have different 404 pages for each version.</p>
  
  <p>How should I do this? I currently have the following code in my <code>app/Exceptions/Handles.php</code> file:</p>
  
  <pre><code>/**
      * Render an exception into an HTTP response.
      *
      * @param  \Illuminate\Http\Request  $request
      * @param  \Exception  $exception
      * @return \Illuminate\Http\Response
      */
  public function render($request, Exception $exception)
  {
      if($exception instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException)
      {
          $view = $request-&gt;is('admin/*') ? 'acp.errors.404' : 'errors.404' ;
  
          return response()-&gt;view($view, [], 404);
      }
      return parent::render($request, $exception);
  }
  </code></pre>
  
  <p>But I use the package <a href="https://github.com/spatie/laravel-permission" rel="noreferrer"><code>spatie/laravel-permission</code></a> and get the following error;</p>
  
  <pre><code>Trying to get property 'role' of non-object (View: F:\Development\RPR\site\resources\views\layouts\acp.blade.php) (View: F:\Development\RPR\site\resources\views\layouts\acp.blade.php)
  </code></pre>
  
  <p>I use in <code>acp.blade.php</code> <code>auth()-&gt;user()-&gt;role</code>, to get the user role, which just works fine without any exception. How should I fix this?</p>