/**
  * Register the addon routes.
  *
  * @param AddonServiceProvider $provider
  * @param Addon $addon
  */
 protected function registerRoutes(AddonServiceProvider $provider, Addon $addon)
 {
     if ($this->routesAreCached()) {
         return;
     }
     if (!($routes = $provider->getRoutes())) {
         return;
     }
     foreach ($routes as $uri => $route) {
         /*
          * If the route definition is an
          * not an array then let's make it one.
          * Array type routes give us more control
          * and allow us to pass information in the
          * request's route action array.
          */
         if (!is_array($route)) {
             $route = ['uses' => $route];
         }
         $verb = array_pull($route, 'verb', 'any');
         $middleware = array_pull($route, 'middleware', []);
         $constraints = array_pull($route, 'constraints', []);
         array_set($route, 'streams::addon', $addon->getNamespace());
         if (is_string($route['uses']) && !str_contains($route['uses'], '@')) {
             $this->router->resource($uri, $route['uses']);
         } else {
             $route = $this->router->{$verb}($uri, $route)->where($constraints);
             if ($middleware) {
                 call_user_func_array([$route, 'middleware'], (array) $middleware);
             }
         }
     }
 }