Регистрация директив blade.

@return void
431647
protected function registerBladeDirectives()
    {
        Blade::directive('widget', function ($expression) {
            $widgetsService = app()->make('InetStudio\Widgets\Contracts\Services\Back\WidgetsServiceContract');

            $widget = $widgetsService->getWidgetObject($expression);

            if ($widget->id) {
                $view = $widget->view;

                if (view()->exists($view)) {
                    return view($view, $widget->params);
                }
            }

            return '';
        });
    }
552606
public function validate()
    {
        $registers = $this->getRegisters();
        $triggerFunctions = $this->getTriggerFunctions();
        $globalActions = $this->getGlobalActions();
        $initialActions = $this->getInitialActions();
        $commonActions = $this->getCommonActions();
        $steps = $this->getSteps();
        $splits = $this->getSplits();
        $joins = $this->getJoins();


        ValidationHelper::validate($registers);
        ValidationHelper::validate($triggerFunctions);
        ValidationHelper::validate($globalActions);
        ValidationHelper::validate($initialActions);
        ValidationHelper::validate($commonActions);
        ValidationHelper::validate($steps);
        ValidationHelper::validate($splits);
        ValidationHelper::validate($joins);


        $actions = [];

        foreach ($globalActions as $action) {
            $actionId = $action->getId();
            if (array_key_exists($actionId, $actions)) {
                $errMsg = sprintf(
                    'Ошибка валидация. Действие с id %s уже существует',
                    $actionId
                );
                throw new InvalidWorkflowDescriptorException($errMsg);
            }
            $actions[$actionId] = $actionId;
        }

        foreach ($steps as $step) {
            $j = $step->getActions();

            foreach ($j as $action) {
                if (!$action->isCommon()) {
                    $actionId = $action->getId();
                    if (array_key_exists($actionId, $actions)) {
                        $errMsg = sprintf(
                            'Действие с id %s найденное у шага %s является дубликатом',
                            $actionId,
                            $step->getId()
                        );
                        throw new InvalidWorkflowDescriptorException($errMsg);
                    }
                    $actions[$actionId] = $actionId;
                }
            }
        }


        foreach ($commonActions as $action) {
            $actionId = $action->getId();
            if (array_key_exists($actionId, $actions)) {
                $errMsg = sprintf(
                    'common-action  с id %s является дубликатом',
                    $actionId
                );
                throw new InvalidWorkflowDescriptorException($errMsg);
            }
        }


        $this->validateDtd();
    }
320364
public function fire()
    {
        $models = ManagerMigrator::get();
        foreach ($models as $class => $migrators) {
            foreach ($migrators as $data) {
                $this->rows = [];
                //            $this->error(str_repeat('=', 80));
                $this->error(str_pad(' ' . $class . ' ', 80, '=', STR_PAD_BOTH));
                //            $this->error(str_repeat('=', 80));
                $vendor = Arr::get($data, 'vendor');
                $type = Arr::get($data, 'type');
                $v = $vendor ? $vendor . '::' : '';
                $key = $v . 'migrator/' . $type;
                $config = \Config::get($key, false);
                if(!$config) {
                    $this->error('Не обнаружен конфиг мигратора ' . $key);
                    continue;
                }
                $indexes = Arr::get($config, 'indexes', []);
                $fields = Arr::get($config, 'fields', []);
                /** @var Model $model */
                $model = new  $class;
                $table_name = $model->getTable();
                $this->syncFields($table_name, $fields);
                $this->rows[] = new TableSeparator();
                $this->syncIndexes($table_name, $indexes);
                $this->table([
                    '[#]',
                    'Тип',
                    'Имя',
                    'Дополнительные характеристики',
                    'Результат',
                ], $this->rows
                );
            }
        }

        echo PHP_EOL;
        $this->question('Синхронизация зарегистрированных типов структур завершена');
    }
205948
public function boot()
    {
        $this->publishes([
            __DIR__.'/../config/markdown.php' => config_path('markdown.php'),
        ]);

        Blade::directive('markdown', function($markdown) {
            if ($markdown) {
                return "<?php echo app('Indal\Markdown\Parser')->parse($markdown); ?>";
            }

            return "<?php app('Indal\Markdown\Parser')->begin() ?>";
        });

        Blade::directive('endmarkdown', function () {
            return "<?php echo app('Indal\Markdown\Parser')->end() ?>";
        });
    }
1129122
public function init()
	{
		if ($this->conf['timezone'])
		{
			date_default_timezone_set($this->conf['timezone']);
		}
		# Определение путей
		$this->init_resolve();
		# Инициализация сессии
		$this->init_session();
		# Изменяем путь поиска подключаемых файлов
		set_include_path(dirname(__FILE__) . '/lib' . PATH_SEPARATOR . get_include_path());
		# Читаем настройки
		$this->initSettings();
		# Первичный разбор запроса
		$this->init_request();
		# Настройка локали
		$this->initLocale();
		# Подключение базовых классов
		$this->initClasses();
		# Инициализация расширений
		$this->init_extensions();
		# Подключение к источнику данных
		$this->initDataSource();
        $this->plugins = Eresus_Plugin_Registry::getInstance();
        $this->plugins->init();
		# Проверка сессии
		$this->check_session();
		# Проверка логина/логаута
		$this->check_loginout();
		# Попытка cookie-логина
		$this->check_cookies();
		# Обновление данных о пользователе
		$this->reset_login();
		$this->sections = new Sections;
		$GLOBALS['KERNEL']['loaded'] = true; # Флаг загрузки ядра
	}
711546
public function __HANDLER()
    {
        // Create query to get users
        $query = dbQuery('user')->Active(1)->order_by('UserID');

        // Create generic table for users
        $table = new Table($query);

        // Установим представление
        m()->view('main/index')->title(t('Пользователи системы', true))
            ->all_materials(true)
            // Установим шаблон таблицы пользователей
            ->user_table($table->render());
    }
1338842
protected function registerBlade5_1()
    {
        // role
        Blade::directive('role', function ($expression) {
            return "<?php if (Auth::check() && Auth::user()->is{$expression}): ?>";
        });

        Blade::directive('endrole', function () {
            return "<?php endif; ?>";
        });

        // permission
        Blade::directive('permission', function ($expression) {
            return "<?php if (Auth::check() && Auth::user()->can{$expression}): ?>";
        });

        Blade::directive('endpermission', function () {
            return "<?php endif; ?>";
        });
    }
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; ?>';
        });
    }
286864
public function boot() {
        $this->publishes([
            __DIR__ . '/Config/crudgenerator.php' => config_path('sirgrimorum/crudgenerator.php'),
            __DIR__ . '/Config/mimebyext.php' => config_path('sirgrimorum/mimebyext.php'),
            __DIR__ . '/Config/models' => config_path('sirgrimorum/models'),
                ], 'config');

        $this->loadTranslationsFrom(__DIR__ . 'Lang', 'crudgenerator');
        $this->loadRoutesFrom(__DIR__ . '/Routes/web.php');
        $this->loadViewsFrom(__DIR__ . '/Views', 'sirgrimorum');
        $this->publishes([
            __DIR__ . '/Views/admin' => resource_path('views/vendor/sirgrimorum/admin'),
                ], 'views');
        $this->publishes([
            __DIR__ . '/Views/templates' => resource_path('views/vendor/sirgrimorum/templates'),
                ], 'templateviews');
        $this->publishes([
            __DIR__ . '/Views/crudgen/create.blade.php' => resource_path('views/vendor/sirgrimorum/crudgen/create.blade.php'),
            __DIR__ . '/Views/crudgen/edit.blade.php' => resource_path('views/vendor/sirgrimorum/crudgen/edit.blade.php'),
            __DIR__ . '/Views/crudgen/error.blade.php' => resource_path('views/vendor/sirgrimorum/crudgen/error.blade.php'),
            __DIR__ . '/Views/crudgen/includes.blade.php' => resource_path('views/vendor/sirgrimorum/crudgen/includes.blade.php'),
            __DIR__ . '/Views/crudgen/list.blade.php' => resource_path('views/vendor/sirgrimorum/crudgen/list.blade.php'),
            __DIR__ . '/Views/crudgen/show.blade.php' => resource_path('views/vendor/sirgrimorum/crudgen/show.blade.php'),
                ], 'crudviews');
        $this->publishes([
            __DIR__ . '/Views/templates' => resource_path('views/vendor/sirgrimorum/templates'),
                ], 'templates');

        $this->publishes([
            __DIR__ . '/Lang' => resource_path('lang/vendor/crudgenerator'),
                ], 'lang');
        $this->publishes([
            __DIR__ . '/Langapp' => resource_path('lang'),
                ], 'langapp');

        /**
         * Assets
         */
        $this->publishes([
            __DIR__ . '/Assets/images' => public_path('vendor/sirgrimorum/images'),
                ], 'assets');
        $this->publishes([
            __DIR__ . '/Assets/ckeditor' => public_path('vendor/sirgrimorum/ckeditor'),
                ], 'assets');
        $this->publishes([
            __DIR__ . '/Assets/jquerytables' => public_path('vendor/sirgrimorum/jquerytables'),
                ], 'assets');
        $this->publishes([
            __DIR__ . '/Assets/slider' => public_path('vendor/sirgrimorum/slider'),
                ], 'assets');
        $this->publishes([
            __DIR__ . '/Assets/confirm' => public_path('vendor/sirgrimorum/confirm'),
                ], 'assets');
        $this->publishes([
            __DIR__ . '/Assets/datetimepicker' => public_path('vendor/sirgrimorum/datetimepicker'),
                ], 'assets');
        $this->publishes([
            __DIR__ . '/Assets/select2' => public_path('vendor/sirgrimorum/select2'),
                ], 'assets');
        $this->publishes([
            __DIR__ . '/Assets/typeahead' => public_path('vendor/sirgrimorum/typeahead'),
                ], 'assets');

        /**
         * Extended validator
         */
        Validator::resolver(
                function($translator, $data, $rules, $messages, $customAttributes ) {
            return new ExtendedValidator($translator, $data, $rules, $messages, $customAttributes);
        }
        );
        
        /**
         * Blade directives
         */
        Blade::directive('handleCrudMessages', function($tipo) {
            $tipo = str_replace([' ', '"', "'"], '', $tipo);
            $html = "";
            switch($tipo){
                case 'error':
                    $html = "<?php if (session(config('sirgrimorum.crudgenerator.error_messages_key'))) : ?>".
                        '<div class="container">'.
                        '    <div class="alert alert-danger alert-dismissible fade show" role="alert">'.
                        '        <button type="button" class="close" data-dismiss="alert" aria-label="{{trans("crudgenerator::admin.layout.labels.close")}}"><span aria-hidden="true">&times;</span></button>'.
                        '        {!! session(config("sirgrimorum.crudgenerator.error_messages_key")) !!}'.
                        '    </div>'.
                        '</div>'.
                        "<?php endif; ?>";
                    break;
                case 'status':
                    $html = "<?php if (session(config('sirgrimorum.crudgenerator.status_messages_key'))) : ?>".
                        '<div class="container">'.
                        '    <div class="alert alert-success alert-dismissible fade show" role="alert">'.
                        '        <button type="button" class="close" data-dismiss="alert" aria-label="{{trans("crudgenerator::admin.layout.labels.close")}}"><span aria-hidden="true">&times;</span></button>'.
                        '        {!! session(config("sirgrimorum.crudgenerator.status_messages_key")) !!}'.
                        '    </div>'.
                        '</div>'.
                        "<?php endif; ?>";
                    break;
            }
            //echo $html;
            return $html;
        });
        /**
         * Console commands
         */
        Artisan::command('crudgen:sendalert ', function () {
            $alertaClass = $this->ask("Notification Class?");
            if (class_exists($alertaClass)) {
                $email = $this->anticipate("User email?", ['andres.espinosa@grimorum.com']);
                if ($toUser = \App\User::where("email", "=", $email)->first()) {
                    $message = $this->ask("Message?");
                    /* $options = array(
                      'cluster' => 'us2',
                      'encrypted' => true
                      );
                      $pusher = new Pusher(
                      'adf503a8756876656ec6', 'b21a0ee639fbb893e41d', '481076', $options
                      );
                     */
                    $data = [];
                    $data['message'] = $message;
                    /* $result = $pusher->trigger('my-channel', 'my-event', $data, null, true);
                      $this->line(print_r($result, true)); */
                    $tiempo = $this->ask("Send in? (Just a number,next you will select seconds, minutes, etc.)");
                    if (!is_int((int) $tiempo)) {
                        $tiempo = $this->ask("Send in? HAS TO BE AN INTEGER NUMBER");
                    }
                    if (is_int((int) $tiempo)) {
                        $unidad = $this->choice('...', ['seconds', 'minutes', 'hours', 'days'], 0);
                        switch ($unidad) {
                            case 'seconds':
                                $when = now()->addSeconds($tiempo);
                                break;
                            case 'minutes':
                                $when = now()->addMinutes($tiempo);
                                break;
                            case 'hours':
                                $when = now()->addHours($tiempo);
                                break;
                            case 'days':
                                $when = now()->addDays($tiempo);
                                break;
                            default:
                                $when = now()->addMinutes($tiempo);
                                break;
                        }
                        $toUser->notify((new $alertaClass($data))
                                        ->delay($when)
                        );
                        $this->info("Listo!");
                    } else {
                        $this->error("Paila!");
                    }
                } else {
                    $this->error("User not found");
                }
            } else {
                $this->error("Class not found");
            }
        })->describe('Broadcast an alert to a user');

        Artisan::command('crudgen:createmodel {table : The Table name} {--path= : Provide a custom paht for saving the model file relative to base_path()}', function ($table) {
            $this->line("Preparing model attributes");
            $bar = $this->output->createProgressBar(4);
            $options = $this->options('path');
            //$modelName = $singular = substr($table, 0, strlen($table) - 1);
            $modelName = $singular = str_singular($table);
            if ($options['path'] != "") {
                $path = $options['path'];
            } else {
                $path = "app/" . ucfirst($modelName);
            }
            $path = str_replace("//", "/", str_replace(["\\", " "], ["/", ""], $path));
            $AuxclassName = explode("/", str_replace(".php", "", $path));
            $className = "";
            $justPath = "";
            $prefijoPath = "/";
            $prefijo = "";
            $fileName = "";
            $nameSpace = "";
            foreach ($AuxclassName as $indice => $pedazo) {
                if ($indice == count($AuxclassName) - 1) {
                    $nameSpace = $className;
                    $fileName = str_finish(ucfirst($pedazo), ".php");
                    $modelName = strtolower($pedazo);
                } else {
                    $justPath .=$prefijoPath . $pedazo;
                    $prefijoPath = "/";
                }
                $className .= $prefijo . ucfirst($pedazo);
                $prefijo = "\\";
            }
            $path = str_finish($path, ".php");
            $bar->advance();
            $this->line("Loading details from {$table} table");
            $config = CrudGenerator::getModelDetailsFromDb($table);
            $config["modelo"] = $config["model"] = $modelName;
            $config["nameSpace"] = $nameSpace;
            $bar->advance();
            $this->info("Details loaded!");
            //$this->line(print_r($config, true));
            $bar->advance();
            $confirm = $this->choice("Do you wisth to continue and save the model to '{$path}' with the className '{$className}'?", ['yes', 'no'], 0);
            if ($confirm == 'yes') {
                $this->line("Saving Model for {$modelName} in {$path} with className '{$className}'");
                if (CrudGenerator::saveResource("sirgrimorum::templates.model", false, base_path($justPath), $fileName, $config)) {
                    $this->info("Model file saved!");
                    $bar->finish();
                } else {
                    $this->error("Something went wrong and the model file could not be saved");
                    $bar->finish();
                }
            } else {
                $bar->finish();
            }
        })->describe('Create a Model file based on a database table');

        Artisan::command('crudgen:createlang {model : The The NAME of the model} {--path= : Provide a custom paht for saving the model langs relatice to resource_path(), default is in vendor/crudgenerator (trans(crudgenerator::model))}', function ($model) {
            $this->line("Preparing model attributes");
            $bar = $this->output->createProgressBar(5);
            $options = $this->options('path');
            if ($options['path'] != "") {
                $path = $options['path'];
            } else {
                $path = "lang/vendor/crudgenerator/" . config("app.locale");
            }
            $path = str_replace("//", "/", str_replace(["\\", " "], ["/", ""], $path));
            $filename = str_finish(strtolower($model), ".php");
            $bar->advance();
            $this->line("Loading config array for {$model}");
            $config = CrudGenerator::getConfig($model, false);
            $bar->advance();
            $this->info("Config loaded!");
            //$this->line(print_r($config, true));
            $bar->advance();
            $this->line("Saving Lang file for {$model} in {$path} with filename '{$filename}'");
            if (CrudGenerator::saveResource("sirgrimorum::templates.lang", false, resource_path($path), $filename, $config)) {
                $this->info("Model Lang file saved!");
            } else {
                $this->error("Something went wrong and the model lang file could not be saved");
            }
            $bar->advance();
            $confirm = $this->choice("Do you wisth to create a Lang File for the model in es?", ['yes', 'no'], 0);
            if ($confirm == 'yes') {
                $path = "lang/vendor/crudgenerator/es";
                $filename = str_finish(strtolower($model), ".php");
                $this->line("Saving Lang file for {$model} in {$path} with filename '{$filename}'");
                if (CrudGenerator::saveResource("sirgrimorum::templates.langes", false, resource_path($path), $filename, $config)) {
                    $this->info("Model Lang file saved!");
                    $bar->finish();
                } else {
                    $this->error("Something went wrong and the model lang file could not be saved");
                    $bar->finish();
                }
            }
            $bar->finish();
        })->describe('Create a Model Lang file from config array');

        Artisan::command('crudgen:createconfig {model : The NAME of the model}{--merge : Try to merge with existing config file if it exist}{--path= : Provide a custom paht for saving the config file}', function ($model) {
            $this->line("Generating Config for {$model}");
            $bar = $this->output->createProgressBar(4);
            $options = $this->options('merge');
            if ($options['merge']) {
                $this->line("mergin");
                $config = CrudGenerator::getConfig($model, true, '', '', false);
            } else {
                $this->line("not mergin");
                $config = CrudGenerator::getConfig($model, false, '', '', false, true, true);
            }

            $bar->advance();
            $options = $this->options('path');
            if ($options['path'] != "") {
                $path = $options['path'];
            } else {
                $path = "sirgrimorum.models." . strtolower($model);
            }
            $this->info("Config generated!");
            //$this->line(print_r($config, true));
            $bar->advance();
            $confirm = $this->choice("Do you wisth to continue and save config to '{$path}'?", ['yes', 'no'], 0);
            if ($confirm == 'yes') {
                $this->line("Saving Config for {$model} in {$path}");
                if (CrudGenerator::saveConfig($config, $path)) {
                    $this->info("Config file saved!");
                    $bar->advance();
                    $confirm = $this->choice("Do you wisth to register the new config to the crudgenerator configuration file?", ['yes', 'no'], 0);
                    if ($confirm == 'yes') {
                        $this->line("Registering Config for {$model} in crudgenerator configuration file");
                        if (CrudGenerator::registerConfig($config, $path)) {
                            $this->info("Config registered!");
                            $bar->finish();
                        } else {
                            $this->error("Something went wrong and config could not be registered");
                            $bar->finish();
                        }
                    } else {
                        $bar->finish();
                    }
                } else {
                    $this->error("Something went wrong and the config file could not be saved");
                    $bar->finish();
                }
            } else {
                $bar->finish();
            }
        })->describe('Create a config file for a model');

        Artisan::command('crudgen:registermiddleware', function() {
            if (CrudGenerator::registerMiddleware()) {
                $this->info("CrudGenerator middleware registered");
            } else {
                $this->error("Something went wrong registering CrudGenerator middleware, please register ir in app/Http/Kernel.php");
            }
        })->describe('Register the CrudGenerator middleware in app/Http/Kernel.php');

        Artisan::command('crudgen:resources {model : The NAME of the model}', function ($model) {
            $bar = $this->output->createProgressBar(12);
            $confirm = $this->choice("Do you wisth to generate the files with Localized Routes?", ['yes', 'no'], 0);
            if ($confirm == "yes") {
                $localized = true;
            } else {
                $localized = false;
            }
            $config = CrudGenerator::getConfig($model, false);
            $confirm = $this->choice("Do you wisth to generate Controller, Request, Policy and Repository files?", ['yes', 'no'], 0);
            if ($confirm == 'yes') {
                $results = CrudGenerator::generateResources($config, $localized, $bar, "controller");
                if ($results[0]) {
                    $this->info("Controller file created");
                } else {
                    $this->error("Something went wrong saving Controller file");
                }
                if ($results[1]) {
                    $this->info("Request file created");
                } else {
                    $this->error("Something went wrong saving Request file");
                }
                if ($results[2]) {
                    $this->info("Policy file created");
                } else {
                    $this->error("Something went wrong saving Policy file");
                }
                if ($results[3]) {
                    $this->info("Repository file created");
                } else {
                    $this->error("Something went wrong saving Repository file");
                }
            }
            $confirm = $this->choice("Do you wisth to generate Create, Edit, Index and Show views?", ['yes', 'no'], 0);
            if ($confirm == 'yes') {
                $results = CrudGenerator::generateResources($config, $localized, $bar, "views");
                if ($results[0]) {
                    $this->info("Create view file created");
                } else {
                    $this->error("Something went wrong saving Create view file");
                }
                if ($results[1]) {
                    $this->info("Edit view file created");
                } else {
                    $this->error("Something went wrong saving Edit view file");
                }
                if ($results[2]) {
                    $this->info("Index view file created");
                } else {
                    $this->error("Something went wrong saving Index view file");
                }
                if ($results[3]) {
                    $this->info("Show view file created");
                } else {
                    $this->error("Something went wrong saving Show view file");
                }
            }
            $confirm = $this->choice("Do you wisth to append new routes for the model (web routes)?", ['yes', 'no'], 0);
            if ($confirm == 'yes') {
                if (CrudGenerator::registerRoutes($config, $localized)) {
                    $this->info("Routes registered");
                } else {
                    $this->error("Something went wrong registering routes");
                }
            }
            CrudGenerator::registerTransRoutes($config);
            $confirm = $this->choice("Do you wisth to register the model policy?", ['yes', 'no'], 0);
            if ($confirm == 'yes') {
                if (CrudGenerator::registerPolicy($config)) {
                    $this->info("Policy registered");
                } else {
                    $this->error("Something went wrong registering the policy");
                }
            }
            $bar->advance();
            $confirm = $this->choice("Do you wisth to create a Lang File for the model?", ['yes', 'no'], 0);
            if ($confirm == 'yes') {
                $path = "lang/vendor/crudgenerator/" . config("app.locale");
                $filename = str_finish(strtolower($model), ".php");
                $this->line("Saving Lang file for {$model} in {$path} with filename '{$filename}'");
                if (CrudGenerator::saveResource("sirgrimorum::templates.lang", $localized, resource_path($path), $filename, $config)) {
                    $this->info("Model Lang file saved!");
                } else {
                    $this->error("Something went wrong and the model lang file could not be saved");
                }
            }
            $bar->advance();
            $confirm = $this->choice("Do you wisth to create a Lang File for the model in es?", ['yes', 'no'], 0);
            if ($confirm == 'yes') {
                $path = "lang/vendor/crudgenerator/es";
                $filename = str_finish(strtolower($model), ".php");
                $this->line("Saving Lang file for {$model} in {$path} with filename '{$filename}'");
                if (CrudGenerator::saveResource("sirgrimorum::templates.langes", $localized, resource_path($path), $filename, $config)) {
                    $this->info("Model Lang file saved!");
                    $bar->finish();
                } else {
                    $this->error("Something went wrong and the model lang file could not be saved");
                    $bar->finish();
                }
            }
            $bar->finish();
        })->describe('Create a config file for a model');
    }
530061
public function handle() {
        dd($this->arguments(), $this->options());
        $this->name_studly = Str::studly($this->argument('name'));
        $this->table       = Str::plural(Str::snake(class_basename($this->argument('name'))));
        //создали миграцию
        $this->makeMigration();
        //создали модель
        $this->makeModel();
    }
660603
public function boot()
    {
        // Publish config files
        $this->publishes([__DIR__ . DIRECTORY_SEPARATOR . 'config/config.php' => config_path('entrust.php'),]);

        // Register commands
        $this->commands('command.entrust.migration');

        // Register blade directives
        $this->bladeDirectives();
    }
1214753
protected function registerBladeDirectives()
    {
        $this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) {
            $bladeCompiler->directive('hasrole', function ($role) {
                return "<?php if(has_role({$role})): ?>";
            });
            $bladeCompiler->directive('endhasrole', function () {
                return '<?php endif; ?>';
            });

            $bladeCompiler->directive('may', function ($permission) {
                return "<?php if(may({$permission})): ?>";
            });
            $bladeCompiler->directive('endmay', function () {
                return '<?php endif; ?>';
            });

            $bladeCompiler->directive('maynot', function ($permission) {
                return "<?php if(maynot({$permission})): ?>";
            });
            $bladeCompiler->directive('endmaynot', function () {
                return '<?php endif; ?>';
            });

            $bladeCompiler->directive('mayall', function ($permissions) {
                return "<?php if(mayall({$permissions})): ?>";
            });
            $bladeCompiler->directive('endmayall', function () {
                return '<?php endif; ?>';
            });
        });
    }
125954
public function boot()
    {
        $this->publishes([
            __DIR__ . '/database/migrations/' => base_path('/database/migrations')
        ]);
        Blade::directive('ifUserIs', function($expression){
            return "<?php if(Auth::check() && Auth::user()->hasRole{$expression}): ?>";
        });
        Blade::directive('ifUserCan', function($expression){
            return "<?php if(Auth::check() && Auth::user()->canDo{$expression}): ?>";
        });
    }
1259818
public function boot()
    {
        $path = realpath(__DIR__.'/../config/config.php');

        $this->publishes([$path => config_path('money.php')], 'config');
        $this->mergeConfigFrom($path, 'money');

        BladeExtension::register($this->app->make('blade.compiler'));
        Money::setLocale($this->app->make('config')->get('money.locale'));
        Money::setCurrency($this->app->make('config')->get('money.currency'));
    }
770066
public function boot()
    {
        $this->bladeDirectives();
        $this->bladeExtensions();

        $this->loadViewsFrom(__DIR__.'/resources/views', 'laravel-menu');

        $this->publishes([
            __DIR__.'/resources/views' => base_path('resources/views/vendor/laravel-menu'),
            __DIR__.'/../../config/settings.php' => config_path('laravel-menu/settings.php'),
            __DIR__.'/../../config/views.php' => config_path('laravel-menu/views.php'),
        ]);
    }
553665
public function boot()
    {
        blade::directive('icon', function ($icon) {
            $icon = trim($icon, "'\"");

            if (substr($icon, 0, 1) !== '$') {
                $icon = "'$icon'";
            }

            return "<?= (string)Html::icon($icon); ?>";
        });

        blade::directive('html', function ($html) {
            return "<?= (string)Html::$html; ?>";
        });
    }
871859
public function run()
    {
        $templatePath = $this->customTemplate ?: __DIR__."/template/route.blade.php";

        $module  = camel_case($this->module);
        $model   = camel_case($this->model);

        $view =  View::file($templatePath, [
            "group"         => $this->group,
            "module"        => $module,
            "model"         => $model,
        ]);

        $routeFile = file_get_contents(base_path("routes/web.php"));

        if(strpos($routeFile, ucfirst($module)."Controller@".lcfirst($model)."Lists") === false)
        {
            file_put_contents(base_path("routes/web.php"), str_replace("#", "@", $view->render()), FILE_APPEND);
        }
    }