Register the Blade directive for Blocks.
331619
protected function registerBlockBladeDirective()
    {
        Blade::directive('block', function ($expression) {
            $expression = $this->sanitizeExpression($expression);

            list($module, $component) = explode('::', $expression);

            if (view()->exists("$module::blocks.$component")) {
                return "<?php echo \$__env->make('$module::blocks.$component', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>";
            }
        });
    }
200415
public function register()
    {
        $this->app->singleton('laravel-acl.directives.canAtLeast', Directives\CanAtLeastDirective::class);
        $this->app->singleton('laravel-acl.directives.role', Directives\RoleDirective::class);
        $this->app->singleton('laravel-acl.directives.hasRole', Directives\HasRoleDirective::class);
    }
915725
protected function registerStaplerFastenCommand()
    {
        $this->app->bind('stapler.fasten', function ($app) {
            $migrationsFolderPath = base_path().'/database/migrations';

            return new FastenCommand($app['view'], $app['files'], $migrationsFolderPath);
        });
    }
776020
protected function registerBladeExtensions()
    {
        if (false === $this->app['config']->get('defender.template_helpers', true)) {
            return;
        }

        $this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) {
            /*
             * add @shield and @endshield to blade compiler
             */
            $bladeCompiler->directive('shield', function ($expression) {
                return "<?php if(app('defender')->canDo({$this->stripParentheses($expression)})): ?>";
            });

            $bladeCompiler->directive('endshield', function ($expression) {
                return '<?php endif; ?>';
            });

            /*
             * add @is and @endis to blade compiler
             */
            $bladeCompiler->directive('is', function ($expression) {
                return "<?php if(app('defender')->hasRoles({$this->stripParentheses($expression)})): ?>";
            });

            $bladeCompiler->directive('endis', function ($expression) {
                return '<?php endif; ?>';
            });

            /*
             * add @isnot and @endisnot to blade compiler
             */
            $bladeCompiler->directive('isnot', function ($expression) {
                return "<?php if(!app('defender')->hasRoles({$this->stripParentheses($expression)})): ?>";
            });

            $bladeCompiler->directive('endisnot', function ($expression) {
                return '<?php endif; ?>';
            });
        });
    }
403877
protected function registerListeners()
    {
        Event::listen(RouteMatched::class, BlockLoad::class);
        Event::listen(GzeroRouteMatched::class, BlockLoad::class);
        Event::listen('block.*', BlockCacheClear::class);
    }
925742
protected function registerBladeDirectives()
    {
        /** @var BladeCompiler $blade */
        $blade = $this->app['blade.compiler'];
        $blade->directive('canAtLeast', function ($expression) {
            return "<?php if (app('laravel-acl.directives.canAtLeast')->handle({$expression})): ?>";
        });
        $blade->directive('endCanAtLeast', function ($expression) {
            return '<?php endif; ?>';
        });

        /** @deprecated Please use @role directive. */
        $blade->directive('isRole', function ($expression) {
            return "<?php if (app('laravel-acl.directives.role')->handle({$expression})): ?>";
        });
        $blade->directive('endIsRole', function ($expression) {
            return '<?php endif; ?>';
        });

        $blade->directive('role', function ($expression) {
            return "<?php if (app('laravel-acl.directives.role')->handle({$expression})): ?>";
        });
        $blade->directive('endRole', function ($expression) {
            return '<?php endif; ?>';
        });

        $blade->directive('hasRole', function ($expression) {
            return "<?php if (app('laravel-acl.directives.hasRole')->handle({$expression})): ?>";
        });
        $blade->directive('endHasRole', function ($expression) {
            return '<?php endif; ?>';
        });
    }
113990
protected function registerDirectives()
    {
        if (version_compare($this->app->version(), '5.5', '>=')) {
            // Workaround to support the PHP5.6 syntax.
            // Even tho the laravel version will lock to 7.0 >=
            // but the code is still complied and throws syntax error on 5.6.
            $blade = Blade::getFacadeRoot();
            $if    = 'if';

            foreach (['desktop', 'tablet', 'mobile'] as $key) {
                $blade->$if($key, function () use ($key) {
                    $fn = 'is' . $key;
                    return app()->make('browser-detect')->detect()->$fn();
                });
            }

            $blade->$if('browser', function ($fn) {
                return app()->make('browser-detect')->detect()->$fn();
            });
        }
    }
769657
protected function registerBladeMinifier()
    {
        $this->app->singleton('htmlmin.blade', function (Container $app) {
            $force = $app->config->get('htmlmin.force', false);

            return new BladeMinifier($force);
        });

        $this->app->alias('htmlmin.blade', BladeMinifier::class);
    }
721783
function register(type, name, create) {
		if (!(type in definitions)) {
			definitions[type] = {};
		}

		if (type === 'pipe') {
			create = chain(create, devour);
		}

		definitions[type][name] = create;
	}
964126
public function registerClientLib()
    {
        $jsPath = trim(Template::js('', $this->extension->getId()), '/');
        ClientLibRegistry::getRegistry()->register($this->extension->getId(), $jsPath);

        $cssPath = trim(Template::css('', $this->extension->getId()), '/');
        ClientLibRegistry::getRegistry()->register($this->extension->getId().'Css', $cssPath);
    }
610574
public function registerBlockElements ()
	{
		// Don´t register twice
		if (isset($GLOBALS['TL_CTE']['CTE'])) 
		{
			return;
		}

		$db = \Database::getInstance();

		if ($db->tableExists("tl_elements"))
		{		
			$arrElements = $db->prepare("SELECT * FROM tl_elements ORDER BY sorting ASC")
							  ->execute()
							  ->fetchAllAssoc();	
		}
			
		if ($arrElements === null)
		{
			return;
		}

		// Add content blocks as content elements
		foreach ($arrElements as $arrElement)
		{
			$GLOBALS['TL_CTE']['CTE'][$arrElement['alias']] = 'Agoat\CustomContentElementsBundle\Contao\ContentElement';
			$GLOBALS['TL_LANG']['CTE'][$arrElement['alias']] = array($arrElement['title'],$arrElement['description']);
		}
	}
486648
protected function registerStaplerFastenCommand()
    {
        $this->app->bind('stapler.fasten', function ($app) {
            $migrationsFolderPath = app_path().'/database/migrations';

            return new Commands\FastenCommand($app['view'], $app['files'], $migrationsFolderPath);
        });
    }
629064
protected function enableBladeMarkdownEngine()
    {
        $app = $this->app;

        $app->view->getEngineResolver()->register('blademd', function () use ($app) {
            $compiler = $app['blade.compiler'];
            $markdown = $app['markdown'];

            return new BladeMarkdownEngine($compiler, $markdown);
        });

        $app->view->addExtension('md.blade.php', 'blademd');
    }
555691
public function registerSvgDirectives()
    {
        Blade::directive('eyewitness_svg', function($arguments) {
            $arguments = trim(trim($arguments, "("), ")");
            $arguments = explode(',', $arguments.',');

            $icon = trim($arguments[0], "' ");
            $class = trim(isset($arguments[1]) ? $arguments[1] : '', "' ");
            $width = trim(isset($arguments[2]) ? $arguments[2] : '', "' ");
            $height = trim(isset($arguments[3]) ? $arguments[3] : '', "' ");

            return $this->getIconString($icon, $class, $width, $height);
        });
    }
1356858
private function registerMacros()
    {
        if (
            method_exists(Relation::class, 'hasMacro') &&
            method_exists(Relation::class, 'macro') &&
            ! Relation::hasMacro('paginateFilter') &&
            ! Relation::hasMacro('simplePaginateFilter')
        ) {
            Relation::macro('paginateFilter', function () {
                $paginator = call_user_func_array([$this, 'paginate'], func_get_args());
                $paginator->appends($this->getRelated()->filtered);

                return $paginator;
            });
            Relation::macro('simplePaginateFilter', function () {
                $paginator = call_user_func_array([$this, 'simplePaginate'], func_get_args());
                $paginator->appends($this->getRelated()->filtered);

                return $paginator;
            });
        }
    }
116361
private function bladeDirectives()
    {
        if (!class_exists('\Blade')) return;

        // Call to Entrust::hasRole
        \Blade::directive('role', function($expression) {
            return "<?php if (\\Entrust::hasRole({$expression})) : ?>";
        });

        \Blade::directive('endrole', function($expression) {
            return "<?php endif; // Entrust::hasRole ?>";
        });

        // Call to Entrust::can
        \Blade::directive('permission', function($expression) {
            return "<?php if (\\Entrust::can({$expression})) : ?>";
        });

        \Blade::directive('endpermission', function($expression) {
            return "<?php endif; // Entrust::can ?>";
        });

        // Call to Entrust::ability
        \Blade::directive('ability', function($expression) {
            return "<?php if (\\Entrust::ability({$expression})) : ?>";
        });

        \Blade::directive('endability', function($expression) {
            return "<?php endif; // Entrust::ability ?>";
        });
    }
331716
public function register()
    {
        $this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) {
            $bladeCompiler->directive('module', function ($slug) {
                return "<?php if (Module::exists({$slug}) && Module::isEnabled({$slug})): ?>";
            });

            $bladeCompiler->directive('endmodule', function () {
                return '<?php endif; ?>';
            });
        });
    }