title: Laravel 5.6 - Uncaught RuntimeException: A facade root has not been set
body: <p>I am getting following error when I try to use <strong>Illuminate\Http\Request</strong> in my class. </p>
  
  <p>Error:</p>
  
  <pre><code>PHP Fatal error:  Uncaught RuntimeException: A facade root has not been set. in /home/sasha/Documents/OffProjects/vetnearme/vetnearme/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:218
  Stack trace:
  #0 /home/sasha/Documents/OffProjects/vetnearme/vetnearme/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(396): Illuminate\Support\Facades\Facade::__callStatic('replaceNamespac...', Array)
  #1 /home/sasha/Documents/OffProjects/vetnearme/vetnearme/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(373): Illuminate\Foundation\Exceptions\Handler-&gt;registerErrorViewPaths()
  #2 /home/sasha/Documents/OffProjects/vetnearme/vetnearme/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(288): Illuminate\Foundation\Exceptions\Handler-&gt;renderHttpException(Object(Symfony\Component\HttpKernel\Exception\HttpException))
  #3 /home/sasha/Documents/OffProjects/vetnearme/vetnearme/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(187): Illumina in /home/sasha/Documents/OffProjects/vetnearme/vetnearme/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 218  
  </code></pre>
  
  <p>The class in question:</p>
  
  <p>
  
  <pre><code>namespace App\App\Components;
  
  use Illuminate\Http\Request;
  
  /**
   * This class will be used to build menu for admin panel based on the user role
   */
  class AdminPanelMenu {
  
      static function menu(Request $request){
  
          $user = $request-&gt;user();
  
          if($user-&gt;hasRole['super_admin'])
              return self::superAdmin();
  
          if($user-&gt;hasRole['admin'])
              return self::admin();
  
          if($user-&gt;hasRole['user'])
              return self::user();
  
          return [];
  
      }
  
      private static function superAdmin()
      {
          return [
              'MAIN NAVIGATION',
          ];
      }
  
      private static function admin()
      {
          return [
              'MAIN NAVIGATION',
          ];
      }
  
      private static function user()
      {
          return [
              'MAIN NAVIGATION',
          ];
      }
  
  }
  </code></pre>
  
  <p>What am I doing wrong here?</p>