public function boot()
    {
        $this->publishes([
            __DIR__.'/PublishedAssets/Views/themes' => base_path('resources/themes'),
            __DIR__.'/PublishedAssets/Controllers' => app_path('Http/Controllers/Cms'),
            __DIR__.'/PublishedAssets/Middleware' => app_path('Http/Middleware'),
            __DIR__.'/PublishedAssets/Routes' => base_path('routes'),
            __DIR__.'/PublishedAssets/Config' => base_path('config'),
        ]);

        $this->publishes([
            __DIR__.'/Views' => base_path('resources/views/vendor/cms'),
        ], 'backend');

        $this->loadMigrationsFrom(__DIR__.'/Migrations');

        $theme = config('cms.frontend-theme', 'default');

        $this->loadViewsFrom(__DIR__.'/Views', 'cms');

        View::addLocation(base_path('resources/themes/'.$theme));
        View::addNamespace('cms-frontend', base_path('resources/themes/'.$theme));

        /*
        |--------------------------------------------------------------------------
        | Blade Directives
        |--------------------------------------------------------------------------
        */

        Blade::directive('theme', function ($expression) {
            if (Str::startsWith($expression, '(')) {
                $expression = substr($expression, 1, -1);
            }

            $theme = config('cms.frontend-theme');
            $view = '"cms-frontend::'.str_replace('"', '', str_replace("'", '', $expression)).'"';

            return "<?php echo \$__env->make($view, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>";
        });

        Blade::directive('menu', function ($expression) {
            return "<?php echo Cms::menu($expression); ?>";
        });

        Blade::directive('block', function ($expression) {
            $module = Cms::getModule();
            return "<?php echo optional(\$".$module.")->block($expression); ?>";
        });

        Blade::directive('languages', function ($expression) {
            return "<?php echo Cms::languageLinks($expression); ?>";
        });

        Blade::directive('modules', function ($expression) {
            return "<?php echo Cms::moduleLinks($expression); ?>";
        });

        Blade::directive('widget', function ($expression) {
            return "<?php echo Cms::widget($expression); ?>";
        });

        Blade::directive('promotion', function ($expression) {
            return "<?php echo Cms::promotion($expression); ?>";
        });

        Blade::directive('image', function ($expression) {
            return "<?php echo Cms::image($expression); ?>";
        });

        Blade::directive('image_link', function ($expression) {
            return "<?php echo Cms::imageLink($expression); ?>";
        });

        Blade::directive('images', function ($expression) {
            return "<?php echo Cms::images($expression); ?>";
        });

        Blade::directive('edit', function ($expression) {
            return "<?php echo Cms::editBtn($expression); ?>";
        });

        Blade::directive('editBtn', function ($expression) {
            return "<?php echo Cms::editBtnSecondary($expression); ?>";
        });

        Blade::directive('markdown', function ($expression) {
            return "<?php echo Markdown::convertToHtml($expression); ?>";
        });
    }
public function boot()
    {
        $this->publishes([
            __DIR__.'/PublishedAssets/Views/themes' => base_path('resources/themes'),
            __DIR__.'/PublishedAssets/Controllers' => app_path('Http/Controllers/Cms'),
            __DIR__.'/PublishedAssets/Middleware' => app_path('Http/Middleware'),
            __DIR__.'/PublishedAssets/Routes' => base_path('routes'),
            __DIR__.'/PublishedAssets/Config' => base_path('config'),
        ]);

        $this->publishes([
            __DIR__.'/Views' => base_path('resources/views/vendor/cms'),
        ], 'backend');

        $this->loadMigrationsFrom(__DIR__.'/Migrations');

        $theme = config('cms.frontend-theme', 'default');

        $this->loadViewsFrom(__DIR__.'/Views', 'cms');

        View::addLocation(base_path('resources/themes/'.$theme));
        View::addNamespace('cms-frontend', base_path('resources/themes/'.$theme));

        /*
        |--------------------------------------------------------------------------
        | Blade Directives
        |--------------------------------------------------------------------------
        */

        Blade::directive('theme', function ($expression) {
            if (Str::startsWith($expression, '(')) {
                $expression = substr($expression, 1, -1);
            }

            $theme = config('cms.frontend-theme');
            $view = '"cms-frontend::'.str_replace('"', '', str_replace("'", '', $expression)).'"';

            return "<?php echo \$__env->make($view, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>";
        });

        Blade::directive('menu', function ($expression) {
            return "<?php echo Cms::menu($expression); ?>";
        });

        Blade::directive('block', function ($expression) {
            $module = Cms::getModule();
            return "<?php echo optional(\$".$module.")->block($expression); ?>";
        });

        Blade::directive('languages', function ($expression) {
            return "<?php echo Cms::languageLinks($expression); ?>";
        });

        Blade::directive('modules', function ($expression) {
            return "<?php echo Cms::moduleLinks($expression); ?>";
        });

        Blade::directive('widget', function ($expression) {
            return "<?php echo Cms::widget($expression); ?>";
        });

        Blade::directive('promotion', function ($expression) {
            return "<?php echo Cms::promotion($expression); ?>";
        });

        Blade::directive('image', function ($expression) {
            return "<?php echo Cms::image($expression); ?>";
        });

        Blade::directive('image_link', function ($expression) {
            return "<?php echo Cms::imageLink($expression); ?>";
        });

        Blade::directive('images', function ($expression) {
            return "<?php echo Cms::images($expression); ?>";
        });

        Blade::directive('edit', function ($expression) {
            return "<?php echo Cms::editBtn($expression); ?>";
        });

        Blade::directive('editBtn', function ($expression) {
            return "<?php echo Cms::editBtnSecondary($expression); ?>";
        });

        Blade::directive('markdown', function ($expression) {
            return "<?php echo Markdown::convertToHtml($expression); ?>";
        });
    }
public function boot ( ) { $ this -> publishes ( [ __DIR__ . '/PublishedAssets/Views/themes' => base_path ( 'resources/themes' ) , __DIR__ . '/PublishedAssets/Controllers' => app_path ( 'Http/Controllers/Cms' ) , __DIR__ . '/PublishedAssets/Middleware' => app_path ( 'Http/Middleware' ) , __DIR__ . '/PublishedAssets/Routes' => base_path ( 'routes' ) , __DIR__ . '/PublishedAssets/Config' => base_path ( 'config' ) , ] ) ; $ this -> publishes ( [ __DIR__ . '/Views' => base_path ( 'resources/views/vendor/cms' ) , ] , 'backend' ) ; $ this -> loadMigrationsFrom ( __DIR__ . '/Migrations' ) ; $ theme = config ( 'cms.frontend-theme' , 'default' ) ; $ this -> loadViewsFrom ( __DIR__ . '/Views' , 'cms' ) ; View :: addLocation ( base_path ( 'resources/themes/' . $ theme ) ) ; View :: addNamespace ( 'cms-frontend' , base_path ( 'resources/themes/' . $ theme ) ) ; /*
        |--------------------------------------------------------------------------
        | Blade Directives
        |--------------------------------------------------------------------------
        */ Blade :: directive ( 'theme' , function ( $ expression ) { if ( Str :: startsWith ( $ expression , '(' ) ) { $ expression = substr ( $ expression , 1 , - 1 ) ; } $ theme = config ( 'cms.frontend-theme' ) ; $ view = '"cms-frontend::' . str_replace ( '"' , '' , str_replace ( "'" , '' , $ expression ) ) . '"' ; return "<?php echo \$__env->make($view, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>" ; } ) ; Blade :: directive ( 'menu' , function ( $ expression ) { return "<?php echo Cms::menu($expression); ?>" ; } ) ; Blade :: directive ( 'block' , function ( $ expression ) { $ module = Cms :: getModule ( ) ; return "<?php echo optional(\$" . $ module . ")->block($expression); ?>" ; } ) ; Blade :: directive ( 'languages' , function ( $ expression ) { return "<?php echo Cms::languageLinks($expression); ?>" ; } ) ; Blade :: directive ( 'modules' , function ( $ expression ) { return "<?php echo Cms::moduleLinks($expression); ?>" ; } ) ; Blade :: directive ( 'widget' , function ( $ expression ) { return "<?php echo Cms::widget($expression); ?>" ; } ) ; Blade :: directive ( 'promotion' , function ( $ expression ) { return "<?php echo Cms::promotion($expression); ?>" ; } ) ; Blade :: directive ( 'image' , function ( $ expression ) { return "<?php echo Cms::image($expression); ?>" ; } ) ; Blade :: directive ( 'image_link' , function ( $ expression ) { return "<?php echo Cms::imageLink($expression); ?>" ; } ) ; Blade :: directive ( 'images' , function ( $ expression ) { return "<?php echo Cms::images($expression); ?>" ; } ) ; Blade :: directive ( 'edit' , function ( $ expression ) { return "<?php echo Cms::editBtn($expression); ?>" ; } ) ; Blade :: directive ( 'editBtn' , function ( $ expression ) { return "<?php echo Cms::editBtnSecondary($expression); ?>" ; } ) ; Blade :: directive ( 'markdown' , function ( $ expression ) { return "<?php echo Markdown::convertToHtml($expression); ?>" ; } ) ; }
Alias the services in the boot.
Alias the services in the boot .