Alias the middleware.

@return void
174773
protected function aliasMiddleware()
    {
        $router = $this->app['router'];

        $method = method_exists($router, 'aliasMiddleware') ? 'aliasMiddleware' : 'middleware';

        foreach ($this->middlewareAliases as $alias => $middleware) {
            $router->$method($alias, $middleware);
        }
    }
747968
public function withMiddleware(string $alias, string $middleware)
    {
        if (! class_exists($middleware)) {
            throw new \Exception("Middleware not found. [{$middleware}]");
        }

        $reflection = new \ReflectionClass($middleware);
        $interfaces = $reflection->getInterfaceNames();

        $isFind = false;
        foreach ($interfaces as &$interface) {
            if ($interface === MiddlewareInterface::class) {
                $isFind = true;
                break;
            }
        }

        if (! $isFind) {
            throw new \Exception("Middleware must instanceof Weipaitang\Middleware\MiddlewareInterface. [{$middleware}]");
        }

        unset($reflection, $interfaces);

        $this->middlewares[$alias] = $middleware;

        return $this;
    }
906609
protected function mapWebRoutes()
    {
        Route::group([
            'middleware' => ['soda.web'],
            'namespace'  => $this->namespace,
        ], function ($router) {
            require __DIR__.'/../../routes/web.php';
        });

        $this->app['router']->getRoutes()->refreshNameLookups();

        $this->app['events']->fire('soda.routing', $this->app->router);
    }
940460
protected function registerProxies() {

		Proxy::setContainer( $this );

		foreach ( $this->proxies as $class => $alias ) {
			class_alias( $class, $alias );
		}
	}
1086427
protected function registerClassAliases(): void
	{
		$aliases = $this->config->get('application.class_aliases');

		if(!empty($aliases))
		{
			$aliasLoader = new AliasLoader($aliases);

			spl_autoload_register([$aliasLoader, 'load']);
		}
	}
1323318
public static function setAlias()
    {
        $file = file_get_contents(self::$aliasFilePath);

        $newAliasString = str_replace(
            "'".self::$bowerVendor."'", 
            "'".self::$sourceBower."'", 
            self::$aliasBowerString
            );

        $file = str_replace(
            self::$aliasBowerString, 
            $newAliasString, 
            $file
            );

        $result = file_put_contents(self::$aliasFilePath, $file);

        if ($result) {
            
            echo "Install alias @bower done\n";
        }
    }
221299
protected function registerMiddleware() {
    $middleware = $this->app['config']['app.middleware'];

    foreach ($middleware as $class_name) {
      $filter = app($class_name);
      if ($filter instanceof BeforeInterface) {
        array_push($this->before, $filter);
      }
      if ($filter instanceof AfterInterface) {
        array_push($this->after, $filter);
      }
    }
  }
719209
public function alias(callable $callback)
    {
        $fqn = $this->function_name->fullyQualifiedName();
        \Patchwork\redefine($fqn, $callback);
        $this->assertRedefined($fqn);
    }
1336510
public function registerMiddleware()
    {
        if (is_array($this->middleware()) && count($this->middleware()))
        {
            $middleware = new Middleware($this);
            return $middleware->add();
        }
        return true;
    }
712990
protected function createAliases()
    {
        $loader = \Illuminate\Foundation\AliasLoader::getInstance();
        $loader->alias('BumbleStr', 'Monarkee\Bumble\Support\Facades\BumbleStr');
        $loader->alias('BumbleGravatar', 'Monarkee\Bumble\Support\Facades\Gravatar');

        $loader->alias('BumbleForm', 'Collective\Html\FormFacade');
        $loader->alias('BumbleHtml', 'Collective\Html\HtmlFacade');
    }
1130368
public function processAlias($path = null)
    {
        if (!isset($path)) {
            $path = $this->path;
        }

        if ($this->db->isInitialized() && $this->config->get('alias', true)) {
            foreach (array_keys($this->findAlias($path)) as $pattern) {
                $this->callAliasController($pattern, $path, null);
            }
        }
    }
670614
public function setupMiddleware()
    {
        $this->middleware('antares.auth');
        $this->middleware('antares.can:antares/translations::add-language', ['only' => ['create'],]);
        $this->middleware('antares.can:antares/translations::publish-translations', ['only' => ['publish'],]);
        $this->middleware('antares.can:antares/translations::export-translations', ['only' => ['export'],]);
        $this->middleware('antares.can:antares/translations::import-translations', ['only' => ['import'],]);
        $this->middleware('antares.can:antares/translations::change-language', ['only' => ['change'],]);
    }
1027623
public function generateAliasesAcquia() {
    $this->cloudConfDir = $_SERVER['HOME'] . '/.acquia';
    $this->setAppId();
    $this->cloudConfFileName = 'cloud_api.conf';
    $this->cloudConfFilePath = $this->cloudConfDir . '/' . $this->cloudConfFileName;
    $this->siteAliasDir = $this->getConfigValue('drush.alias-dir');

    $cloudApiConfig = $this->loadCloudApiConfig();
    $this->setCloudApiClient($cloudApiConfig['key'], $cloudApiConfig['secret']);

    $this->say("<info>Gathering site info from Acquia Cloud.</info>");
    $site = $this->cloudApiClient->application($this->appId);

    $error = FALSE;
    try {
      $this->getSiteAliases($site);
    }
    catch (\Exception $e) {
      $error = TRUE;
      $this->logger->error("Did not write aliases for $site->name. Error: " . $e->getMessage());
    }
    if (!$error) {
      $this->say("<info>Aliases were written, type 'drush sa' to see them.</info>");
    }
  }
1005552
protected function resortAliases()
    {
        uksort(
            $this->aliases,
            function ($a, $b) {
                return substr_count($a, '/') < substr_count($b, '/');
            }
        );
    }
473554
public function setupMiddleware()
    {
        $this->middleware('antares.auth');
        $this->middleware("antares.can:antares/logger::analyzer-dashboard", ['only' => ['index']]);
        $this->middleware('antares.can:antares/logger::analyzer-run', ['only' => ['run']]);
        $this->middleware('antares.can:antares/logger::analyzer-server', ['only' => ['server']]);
        $this->middleware('antares.can:antares/logger::analyzer-system', ['only' => ['system']]);
        $this->middleware('antares.can:antares/logger::analyzer-modules', ['only' => ['modules']]);
        $this->middleware('antares.can:antares/logger::analyzer-version', ['only' => ['version']]);
        $this->middleware('antares.can:antares/logger::analyzer-database', ['only' => ['database']]);
        $this->middleware('antares.can:antares/logger::analyzer-logs', ['only' => ['logs']]);
        $this->middleware('antares.can:antares/logger::analyzer-components', ['only' => ['components']]);
        $this->middleware('antares.can:antares/logger::analyzer-checksum', ['only' => ['checksum']]);
    }
995154
protected function registerAliases() : void
    {
        $aliases = [
            'bitcoind'         => 'Denpa\Bitcoin\ClientFactory',
            'bitcoind.client'  => 'Denpa\Bitcoin\LaravelClient',
        ];

        foreach ($aliases as $key => $aliases) {
            foreach ((array) $aliases as $alias) {
                $this->app->alias($key, $alias);
            }
        }
    }
880385
private function registerApiMiddleware()
    {
        /** @var  \Illuminate\Contracts\Config\Repository  $config */
        $config = $this->app['config'];

        foreach ($config->get('api-helper.middleware', []) as $name => $class) {
            $this->aliasMiddleware($name, $class);
        };
    }