Вход Регистрация
Файл: gapps/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php
Строк: 78
<?php

namespace IlluminateFoundationSupportProviders;

use 
IlluminateRoutingRouter;
use 
IlluminateSupportServiceProvider;
use 
IlluminateContractsRoutingUrlGenerator;

class 
RouteServiceProvider extends ServiceProvider
{
    
/**
     * The controller namespace for the application.
     *
     * @var string|null
     */
    
protected $namespace;

    
/**
     * Bootstrap any application services.
     *
     * @param  IlluminateRoutingRouter  $router
     * @return void
     */
    
public function boot(Router $router)
    {
        
$this->setRootControllerNamespace();

        if (
$this->app->routesAreCached()) {
            
$this->loadCachedRoutes();
        } else {
            
$this->loadRoutes();

            
$this->app->booted(function () use ($router) {
                
$router->getRoutes()->refreshNameLookups();
            });
        }
    }

    
/**
     * Set the root controller namespace for the application.
     *
     * @return void
     */
    
protected function setRootControllerNamespace()
    {
        if (
is_null($this->namespace)) {
            return;
        }

        
$this->app[UrlGenerator::class]->setRootControllerNamespace($this->namespace);
    }

    
/**
     * Load the cached routes for the application.
     *
     * @return void
     */
    
protected function loadCachedRoutes()
    {
        
$this->app->booted(function () {
            require 
$this->app->getCachedRoutesPath();
        });
    }

    
/**
     * Load the application routes.
     *
     * @return void
     */
    
protected function loadRoutes()
    {
        
$this->app->call([$this'map']);
    }

    
/**
     * Load the standard routes file for the application.
     *
     * @param  string  $path
     * @return mixed
     */
    
protected function loadRoutesFrom($path)
    {
        
$router $this->app->make(Router::class);

        if (
is_null($this->namespace)) {
            return require 
$path;
        }

        
$router->group(['namespace' => $this->namespace], function (Router $router) use ($path) {
            require 
$path;
        });
    }

    
/**
     * Register the service provider.
     *
     * @return void
     */
    
public function register()
    {
        
//
    
}

    
/**
     * Pass dynamic methods onto the router instance.
     *
     * @param  string  $method
     * @param  array  $parameters
     * @return mixed
     */
    
public function __call($method$parameters)
    {
        return 
call_user_func_array([$this->app->make(Router::class), $method], $parameters);
    }
}
Онлайн: 0
Реклама