Illuminate\Routing\Router::__construct PHP Method

__construct() public method

Create a new Router instance.
public __construct ( Illuminate\Contracts\Events\Dispatcher $events, Illuminate\Container\Container $container = null ) : void
$events Illuminate\Contracts\Events\Dispatcher
$container Illuminate\Container\Container
return void
    public function __construct(Dispatcher $events, Container $container = null)
    {
        $this->events = $events;
        $this->routes = new RouteCollection();
        $this->container = $container ?: new Container();
        $this->bind('_missing', function ($v) {
            return explode('/', $v);
        });
    }

Usage Example

Example #1
0
 /**
  * Router constructor.
  * @param Dispatcher $events
  * @param Container $container
  */
 public function __construct(Dispatcher $events, Container $container)
 {
     parent::__construct($events, $container);
     $this->setRoutes(new RouteCollection());
     $this->adapterService = new AdapterService($this->container);
     $this->setDefaultAdapter(MainAdapter::name);
 }
All Usage Examples Of Illuminate\Routing\Router::__construct