igaster\laravelTheme\themeServiceProvider::boot PHP Method

boot() public method

public boot ( )
    public function boot()
    {
        /*--------------------------------------------------------------------------
        		| Pulish configuration file
        		|--------------------------------------------------------------------------*/
        $this->publishes([__DIR__ . '/config.php' => config_path('themes.php')]);
        /*--------------------------------------------------------------------------
        		| Extend Blade to support Orcherstra\Asset (Asset Managment)
        		|
        		| Syntax:
        		|
        		|   @css (filename, alias, depends-on-alias)
        		|   @js  (filename, alias, depends-on-alias)
        		|--------------------------------------------------------------------------*/
        Blade::extend(function ($value) {
            return preg_replace_callback('/\\@js\\s*\\(\\s*([^),]*)(?:,\\s*([^),]*))?(?:,\\s*([^),]*))?\\)/', function ($match) {
                $p1 = trim($match[1], " \t\n\r\v\"'");
                $p2 = trim(empty($match[2]) ? $p1 : $match[2], " \t\n\r\v\"'");
                $p3 = trim(empty($match[3]) ? '' : $match[3], " \t\n\r\v\"'");
                if (empty($p3)) {
                    return "<?php Asset::script('{$p2}', \\Theme::url('{$p1}'));?>";
                } else {
                    return "<?php Asset::script('{$p2}', \\Theme::url('{$p1}'), '{$p3}');?>";
                }
            }, $value);
        });
        \Blade::extend(function ($value) {
            return preg_replace_callback('/\\@jsIn\\s*\\(\\s*([^),]*)(?:,\\s*([^),]*))?(?:,\\s*([^),]*))?(?:,\\s*([^),]*))?\\)/', function ($match) {
                $p1 = trim($match[1], " \t\n\r\v\"'");
                $p2 = trim($match[2], " \t\n\r\v\"'");
                $p3 = trim(empty($match[3]) ? $p2 : $match[3], " \t\n\r\v\"'");
                $p4 = trim(empty($match[4]) ? '' : $match[4], " \t\n\r\v\"'");
                if (empty($p4)) {
                    return "<?php Asset::container('{$p1}')->script('{$p3}', \\Theme::url('{$p2}'));?>";
                } else {
                    return "<?php Asset::container('{$p1}')->script('{$p3}', \\Theme::url('{$p2}'), '{$p4}');?>";
                }
            }, $value);
        });
        Blade::extend(function ($value) {
            return preg_replace_callback('/\\@css\\s*\\(\\s*([^),]*)(?:,\\s*([^),]*))?(?:,\\s*([^),]*))?\\)/', function ($match) {
                $p1 = trim($match[1], " \t\n\r\v\"'");
                $p2 = trim(empty($match[2]) ? $p1 : $match[2], " \t\n\r\v\"'");
                $p3 = trim(empty($match[3]) ? '' : $match[3], " \t\n\r\v\"'");
                if (empty($p3)) {
                    return "<?php Asset::style('{$p2}', \\Theme::url('{$p1}'));?>";
                } else {
                    return "<?php Asset::style('{$p2}', \\Theme::url('{$p1}'), '{$p3}');?>";
                }
            }, $value);
        });
    }
themeServiceProvider