title: Laravel Cors - Class throttle does not exist after installing CORS package
body: <p>I've installed a CORS package, and it seems to be working(No console errors), however I'm now getting a 500 error <code>Class throttle does not exist</code>. Which I cant get my head around. I believe it may be something to do with my Kernel.php file maybe?</p>
  
  <p>Laravel Framework 5.8.5</p>
  
  <p>Cors library <a href="https://packagist.org/packages/barryvdh/laravel-cors" rel="nofollow noreferrer">https://packagist.org/packages/barryvdh/laravel-cors</a>.</p>
  
  <p>I have tried <code>composer update</code> and <code>composer dump-autoload</code></p>
  
  <p>Kernel.php</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http;
  
  use Illuminate\Foundation\Http\Kernel as HttpKernel;
  
  class Kernel extends HttpKernel
  {
      /**
       * The application's global HTTP middleware stack.
       *
       * These middleware are run during every request to your application.
       *
       * @var array
       */
      protected $middleware = [
          \App\Http\Middleware\CheckForMaintenanceMode::class,
          \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
          \App\Http\Middleware\TrimStrings::class,
          \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
          \App\Http\Middleware\TrustProxies::class,
          \Barryvdh\Cors\HandleCors::class,
      ];
  
      /**
       * The application's route middleware groups.
       *
       * @var array
       */
      protected $middlewareGroups = [
          'web' =&gt; [
              \App\Http\Middleware\EncryptCookies::class,
              \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
              \Illuminate\Session\Middleware\StartSession::class,
              // \Illuminate\Session\Middleware\AuthenticateSession::class,
              \Illuminate\View\Middleware\ShareErrorsFromSession::class,
              \App\Http\Middleware\VerifyCsrfToken::class,
              \Illuminate\Routing\Middleware\SubstituteBindings::class,
          ],
  
          'api' =&gt; [
              'throttle:60,1',
              'bindings',
          ],
      ];
  
      /**
       * The application's route middleware.
       *
       * These middleware may be assigned to groups or used individually.
       *
       * @var array
       */
      protected $routeMiddleware = [
          'auth' =&gt; \App\Http\Middleware\Authenticate::class,
          'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
          'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
  
      ];
  
      /**
       * The priority-sorted list of middleware.
       *
       * This forces non-global middleware to always be in the given order.
       *
       * @var array
       */
      protected $middlewarePriority = [
          \Illuminate\Session\Middleware\StartSession::class,
          \Illuminate\View\Middleware\ShareErrorsFromSession::class,
          \App\Http\Middleware\Authenticate::class,
          \Illuminate\Session\Middleware\AuthenticateSession::class,
          \Illuminate\Routing\Middleware\SubstituteBindings::class,
          \Illuminate\Auth\Middleware\Authorize::class,
      ];
  }
  
  </code></pre>
  
  <p>ApiController.php</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\Validator;
  use App\User;
  use Illuminate\Support\Facades\Hash;
  
  class ApiController extends Controller
  {
      public function generateAccessToken(Request $request)
      {
  
          $http = new \GuzzleHttp\Client;
  
  
  
          $response = $http-&gt;post('http://social.kindle/oauth/token', [
              'form_params' =&gt; [
                  'grant_type' =&gt; 'password',
                  'client_id' =&gt; '1',
                  'client_secret' =&gt; 'yilrEuaPympsmS4ThXx81dvnzAxwY7nQYBpbnLtr',
                  'username' =&gt; $request-&gt;email,
                  'password' =&gt; $request-&gt;password,
                  'scope' =&gt; '',
              ],
          ]);
  
          return json_decode((string) $response-&gt;getBody(), true);
      }
  
      public function post() {
          //header('Access-Control-Allow-Origin: *');
          dd('test');
      }
  }
  
  
  </code></pre>
  
  <p>api.php</p>
  
  <pre><code>&lt;?php
  
     Route::get('/access-token','ApiController@generateAccessToken');
     Route::post('/customer-dash/post', function (Request $request) {
        dd('test');
        //return Auth::user();
     });
  
  
  
  
     Route::middleware('auth:api')-&gt;get('/user', function (Request $request) {
        return Auth::user();
     });
  
  
  
  </code></pre>
  
  <p>Error Stack</p>
  
  <pre><code>{
      "message": "Class throttle does not exist",
      "exception": "ReflectionException",
      "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Container/Container.php",
      "line": 794,
      "trace": [
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Container/Container.php",
              "line": 794,
              "function": "__construct",
              "class": "ReflectionClass",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Container/Container.php",
              "line": 671,
              "function": "build",
              "class": "Illuminate\\Container\\Container",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Container/Container.php",
              "line": 619,
              "function": "resolve",
              "class": "Illuminate\\Container\\Container",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Application.php",
              "line": 757,
              "function": "make",
              "class": "Illuminate\\Container\\Container",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 152,
              "function": "make",
              "class": "Illuminate\\Foundation\\Application",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 104,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
              "line": 682,
              "function": "then",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
              "line": 657,
              "function": "runRouteWithinStack",
              "class": "Illuminate\\Routing\\Router",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
              "line": 623,
              "function": "runRoute",
              "class": "Illuminate\\Routing\\Router",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
              "line": 612,
              "function": "dispatchToRoute",
              "class": "Illuminate\\Routing\\Router",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
              "line": 176,
              "function": "dispatch",
              "class": "Illuminate\\Routing\\Router",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 30,
              "function": "Illuminate\\Foundation\\Http\\{closure}",
              "class": "Illuminate\\Foundation\\Http\\Kernel",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/barryvdh/laravel-cors/src/HandleCors.php",
              "line": 59,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Barryvdh\\Cors\\HandleCors",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/fideloper/proxy/src/TrustProxies.php",
              "line": 57,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Fideloper\\Proxy\\TrustProxies",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
              "line": 21,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
              "line": 21,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
              "line": 27,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
              "line": 62,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 163,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
              "line": 53,
              "function": "Illuminate\\Pipeline\\{closure}",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
              "line": 104,
              "function": "Illuminate\\Routing\\{closure}",
              "class": "Illuminate\\Routing\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
              "line": 151,
              "function": "then",
              "class": "Illuminate\\Pipeline\\Pipeline",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
              "line": 116,
              "function": "sendRequestThroughRouter",
              "class": "Illuminate\\Foundation\\Http\\Kernel",
              "type": "-&gt;"
          },
          {
              "file": "/home/vagrant/code/public/index.php",
              "line": 55,
              "function": "handle",
              "class": "Illuminate\\Foundation\\Http\\Kernel",
              "type": "-&gt;"
          }
      ]
  }
  </code></pre>
  
  <p>I'm trying to hit the '/customer-dash/post' URL from my front end Angular code base but thats when I get the 500 error. Can anyone help resolve the 500 error?</p>
  
  <p>Thanks</p>