protected function addBladeExtensions(Application $app)
    {
        $blade = $app->make('blade.compiler');

        $blade->directive('decorator', function ($expression) {
            return "<?php echo \app('orchestra.decorator')->render({$expression}); ?>";
        });

        $blade->directive('placeholder', function ($expression) {
            $expression = \preg_replace('/\(\s*(.*)\)/', '$1', $expression);

            return "<?php \$__ps = app('orchestra.widget')->make('placeholder.'.{$expression}); "
                        ."foreach (\$__ps as \$__p) { echo value(\$__p->value ?: ''); } ?>";
        });

        $blade->directive('get_meta', function ($expression) {
            return "<?php echo \get_meta({$expression}); ?>";
        });

        $blade->directive('set_meta', function ($expression) {
            return "<?php \set_meta({$expression}); ?>";
        });

        $blade->directive('title', function ($expression) {
            return "<?php echo \app('html')->title({$expression}); ?>";
        });

        $blade->extend(function ($view) {
            $view = \preg_replace('/(\s*)(<\?\s)/', '$1<?php ', $view);
            $view = \preg_replace('/#\{\{\s*(.+?)\s*\}\}/s', '<?php $1; ?>', $view);

            return $view;
        });
    }