public function bindContext($context, Request $request)
    {
        $security = $this->getSecurity($context);

        $this->container->instance(SecurityApi::class, $security);

        $this->container->bind(UrlGeneratorContract::class, function() use ($security){
            return $security->url();
        });

        $this->container->bind(UrlGenerator::class, function(Container $container) use ($security){
            /** @var PermissionAwareUrlGeneratorExtension $url */
            $url = $container->make(PermissionAwareUrlGeneratorExtension::class);
            $url->setUrlGenerator($security->url());

            return $url;
        });

        $this->container->alias(UrlGenerator::class, 'url');

        $request->setUserResolver(function() use ($security){
            return $security->getUser();
        });
    }
public function bindContext($context, Request $request)
    {
        $security = $this->getSecurity($context);

        $this->container->instance(SecurityApi::class, $security);

        $this->container->bind(UrlGeneratorContract::class, function() use ($security){
            return $security->url();
        });

        $this->container->bind(UrlGenerator::class, function(Container $container) use ($security){
            /** @var PermissionAwareUrlGeneratorExtension $url */
            $url = $container->make(PermissionAwareUrlGeneratorExtension::class);
            $url->setUrlGenerator($security->url());

            return $url;
        });

        $this->container->alias(UrlGenerator::class, 'url');

        $request->setUserResolver(function() use ($security){
            return $security->getUser();
        });
    }
public function bindContext ( $ context , Request $ request ) { $ security = $ this -> getSecurity ( $ context ) ; $ this -> container -> instance ( SecurityApi :: class , $ security ) ; $ this -> container -> bind ( UrlGeneratorContract :: class , function ( ) use ( $ security ) { return $ security -> url ( ) ; } ) ; $ this -> container -> bind ( UrlGenerator :: class , function ( Container $ container ) use ( $ security ) { /** @var PermissionAwareUrlGeneratorExtension $url */ $ url = $ container -> make ( PermissionAwareUrlGeneratorExtension :: class ) ; $ url -> setUrlGenerator ( $ security -> url ( ) ) ; return $ url ; } ) ; $ this -> container -> alias ( UrlGenerator :: class , 'url' ) ; $ request -> setUserResolver ( function ( ) use ( $ security ) { return $ security -> getUser ( ) ; } ) ; }
Bind the given security context to the Request and Container.

@param string  $context
@param Request $request
Bind the given security context to the Request and Container .