Closed2

laravel研究

karamawanukaramawanu

Route::get() の挙動

  • Illuminate\Support\Facades\Route extends Facade
    • static::getFacadeAccessor() = 'router';
    • Illuminate/Support/Facades/Facade::__callStatic($method, $args)
      • static::getFacadeRoot();
        • return static::resolveFacadeInstance(static::getFacadeAccessor());
          • static::resolveFacadeInstance
            • return static::resolvedInstance[name] = static::app[name];
      • Facade::$app["router"]->get(...$args)
        • Illuminate/Routing/Router.php::get($uri, $action = null)
          • self::addRoute(['GET', 'HEAD'], $uri, $action);
            • self::addRoute($methods, $uri, $action)
              • return $this->routes->add(this->createRoute(methods, $uri, $action));
                • Illuminate/Routing/Router::createRoute
                  • $route = $this->newRoute( methods, $this->prefix(uri), $action );
                    • self::newRoute($methods, $uri, $action)
                      • (new Route(methods, $uri, $action))->setRouter(this)->setContainer($this->container);
                        • Illuminate/Routing/Route.php::setRouter
                          • $this->router = $router;
                        • Illuminate/Routing/Route.php::setContainer
                          • $this->container = $container;
                  • $this->addWhereClausesToRoute($route);
                • Illuminate/Routing/RouteCollectionInterface::add(Route $route);
                  • Illuminate/Routing/AbstractRouteCollection::get
                    • Illuminate/Routing/RouteCollection::get($method = null)
                      • Arr::get($this->routes, $method, []);
karamawanukaramawanu

Facede::app["router"]の中身

  • bootstrap/app.php
    • $app->singleton(Illuminate\Contracts\Console\Kernel::class, ....);
      • Illuminate/Foundation/Console/Kernel
        • self::$bootstrappers[] = \Illuminate\Foundation\Bootstrap\RegisterFacades::class
        • self:bootstrap()
          • $this->app->bootstrapWith($this->bootstrappers());
          • $this->app->loadDeferredProviders();
          • $this->commands();
            • Illuminate/Foundation/Bootstrap/RegisterFacades::bootstrap(Application $app)
              • Facade::clearResolvedInstances();
              • Facade::setFacadeApplication($app);
          • Illuminate/Foundation/Application::registerCoreContainerAliases
            • $this->alias($key, $alias);
            • { 'router' => [\Illuminate\Routing\Router::class, \Illuminate\Contracts\Routing\Registrar::class, }\Illuminate\Contracts\Routing\BindingRegistrar::class],
              • self::alias("router", [\Illuminate\Routing\Router::class, \Illuminate\Contracts\Routing\Registrar::class, } \Illuminate\Contracts\Routing\BindingRegistrar::class]);
                • Illuminate/Container/Container::alias
                  • $this->aliases[$alias] = $abstract;
                  • $this->abstractAliases[$abstract][] = $alias;
このスクラップは6ヶ月前にクローズされました