function __construct() { // self::$settings = Config::get('garbarinoviajes'); // self::$static = url('statics') . '/'; // if (false == \Illuminate\Support\Facades\Request::ajax()) { self::addJsHeader('http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'); self::addCss('main.css'); // ex bootstrap self::addCss('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'); self::addCss('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.css'); self::addCss('details.css'); // self::addCss('1200.css'); self::addJsFooter('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'); self::addJsFooter('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js'); } // \Illuminate\Support\Facades\Blade::extend(function ($value) { return preg_replace('/(\\s*)@(break|continue)(\\s*)/', '$1<?php $2; ?>$3', $value); }); // view()->composer('*', 'App\\Http\\Composers\\ViewComposer'); }
private function registerDirectives() { Blade::directive('allowed', function ($expression) { if (Str::startsWith($expression, '(')) { $expression = substr($expression, 1, -1); } return "<?php if (app('rbac')->checkAccess(\\Auth::user(), {$expression})): ?>"; }); if (Config::get('rbac.shortDirectives')) { foreach (Rbac::getRepository() as $name => $item) { $directiveName = $item->type == Item::TYPE_PERMISSION ? 'allowed' : 'is'; $directiveName .= Str::studly(str_replace('.', ' ', $name)); Blade::directive($directiveName, function ($expression) use($name) { $expression = trim($expression, '()'); if (!empty($expression)) { $expression = ', ' . $expression; } return "<?php if (app('rbac')->checkAccess(\\Auth::user(), '{$name}'{$expression})): ?>"; }); } } Blade::directive('endallowed', function ($expression) { return "<?php endif; ?>"; }); }
/** * Register blade directives. */ protected function registerBladeDirectives() { Blade::directive('form', function ($expression) { $expression = $this->addParenthesis($expression); return "<?php app('sahib_form')->model{$expression}; ?>"; }); Blade::directive('input', function ($expression) { $expression = $this->addParenthesis($expression); return "<?php echo app('sahib_form')->input{$expression}; ?>"; }); Blade::directive('text', function ($expression) { $expression = $this->addParenthesis($expression); return "<?php echo app('sahib_form')->text{$expression}; ?>"; }); Blade::directive('checkbox', function ($expression) { $expression = $this->addParenthesis($expression); return "<?php echo app('sahib_form')->checkbox{$expression}; ?>"; }); Blade::directive('radio', function ($expression) { $expression = $this->addParenthesis($expression); return "<?php echo app('sahib_form')->radio{$expression}; ?>"; }); Blade::directive('options', function ($expression) { $expression = $this->addParenthesis($expression); return "<?php echo app('sahib_form')->options{$expression}; ?>"; }); Blade::directive('error', function ($expression) { $expression = $this->addParenthesis($expression); return "<?php echo app('sahib_form')->error{$expression}; ?>"; }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { // Blade::directive('dump', function ($data) { return sprintf("<?php (new Illuminate\\Support\\Debug\\Dumper)->dump(%s); ?>", null !== $data ? $data : "get_defined_vars()['__data']"); }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { Blade::extend(function ($value) { return preg_replace('/@define(.+)/', '<?php ${1}; ?>', $value); }); Blade::extend(function ($value) { $value = preg_replace('/(?<=\\s)@switch\\((.*)\\)(\\s*)@case\\((.*)\\)(?=\\s)/', '<?php switch($1):$2case $3: ?>', $value); $value = preg_replace('/(?<=\\s)@endswitch(?=\\s)/', '<?php endswitch; ?>', $value); $value = preg_replace('/(?<=\\s)@case\\((.*)\\)(?=\\s)/', '<?php case $1: ?>', $value); $value = preg_replace('/(?<=\\s)@default(?=\\s)/', '<?php default: ?>', $value); $value = preg_replace('/(?<=\\s)@endcase(?=\\s)/', '<?php break; ?>', $value); return $value; }); Blade::extend(function ($value) { $value = preg_replace('/(?<=\\s)@me\\((.*)\\)(?=\\s)/', '<?php if(is_me(${1})) { ?>', $value); $value = preg_replace('/(?<=\\s)@endme(?=\\s)/', '<?php } ?>', $value); return $value; }); Blade::extend(function ($value) { $value = preg_replace('/(?<=\\s)@auth(?=\\s)/', '<?php if(Auth::user()) { ?>', $value); $value = preg_replace('/(?<=\\s)@endauth(?=\\s)/', '<?php } ?>', $value); return $value; }); Blade::extend(function ($value) { $value = preg_replace('/(?<=\\s)@guest(?=\\s)/', '<?php if(!Auth::user()) { ?>', $value); $value = preg_replace('/(?<=\\s)@endguest(?=\\s)/', '<?php } ?>', $value); return $value; }); }
/** * Register a blade directive. * * @param $name * @param $expression */ protected function registerBladeDirective($name, $expression) { Blade::extend(function ($view) use($name, $expression) { $pattern = $this->createMatcher($name); return preg_replace($pattern, $expression, $view); }); }
public function boot() { $this->publishes([__DIR__ . DIRECTORY_SEPARATOR . 'config.php' => config_path('russian.php')]); Blade::directive('russian', function ($expression) { $className = RussianDollCaching::class; return "<?php echo app('{$className}')->get{$expression}; ?>"; }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { // Formats a string using the specified date pattern // Usage: @datetime($expression) Blade::directive('datetime', function ($expression) { return "<?= with{$expression}->format('F d, Y, h:m A'); ?>"; }); }
public function boot() { $this->publishes([__DIR__ . '/../config/laravel-blade-javascript.php' => config_path('laravel-blade-javascript.php')], 'config'); Blade::directive('javascript', function ($expression) { $expression = $this->makeBackwardsCompatible($expression); return "<?= app('\\Spatie\\BladeJavaScript\\Renderer')->render{$expression}; ?>"; }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { $this->publishes([__DIR__ . '/../config/columnsortable.php' => config_path('columnsortable.php')], 'config'); Blade::directive('sortablelink', function ($expression) { $expression = $expression[0] === '(' ? substr($expression, 1, -1) : $expression; return "<?php echo \\Kyslik\\ColumnSortable\\SortableLink::render(array ({$expression}));?>"; }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { Blade::directive('cache', function ($expression) { return "<?php if (! app('SteveAzz\\RuDolly\\BladeDirective')->setUp{$expression}) : ?>"; }); Blade::directive('endcache', function () { return "<?php endif; echo app('SteveAzz\\RuDolly\\BladeDirective')->tearDown() ?>"; }); }
protected function bootBladeDirective() { Blade::directive('block', function ($expression) { return "<?php if (! Dyusha\\HtmlEditor\\HtmlBlocks::setUp({$expression})) { ?>"; }); Blade::directive('endblock', function () { return "<?php } echo Dyusha\\HtmlEditor\\HtmlBlocks::tearDown() ?>"; }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { array_walk($this->statements, function ($statement) { Blade::directive($statement, function ($expression) use($statement) { $method = 'compile' . ucfirst($statement); return $this->{$method}($expression); }); }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { Blade::directive('Perm', function ($permission) { return '<?php if((Auth::check()&&\\App\\Permission::permission(' . $permission . ', Auth::user()->id))||(!Auth::check()&&\\App\\Permission::guest(' . $permission . '))): ?>'; }); Blade::directive('endPerm', function () { return '<?php endif; ?>'; }); }
protected function registerBlade() { Blade::directive('role', function ($expression) { return "<?php if(auth()->check() && auth()->user()->hasRole({$expression})): ?>"; }); Blade::directive('endrole', function () { return "<?php endif; ?>"; }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { Blade::directive('cache', function ($expresion) { return "<?php if( ! app('Sargilla\\Mamushka\\BladeDirective')->setUp{$expresion} ) { ?>"; }); Blade::directive('endcache', function () { return "<?php } echo app('Sargilla\\Mamushka\\BladeDirective')->tearDown() ?>"; }); }
public function boot() { Blade::directive('gravatar', function () { return '<?="http://www.gravatar.com/avatar/" . md5( strtolower( trim( $user->email ) ) ) . "?d=mm";?>'; }); Blade::directive('csrf', function () { return '<?="<input type=\\"hidden\\" name=\\"_token\\" value=\\"".csrf_token()."\\">";?>'; }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { Blade::directive('break', function () { return "<?php break; ?>"; }); Blade::directive('continue', function () { return "<?php continue; ?>"; }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { /** * Custom Blade directive for checking when a Harvest was last run * and returning a formatted string. */ Blade::directive('lastrundiff', function ($lastRunAt) { return "<?php echo '<span title=\"' . with{$lastRunAt}->format('D, M j, Y g:i:s a') . '\">' . with{$lastRunAt}->diffForHumans() . '</span>'; ?>"; }); }
/** * Extend the blade compiler for the minification process. * * @return void */ protected function setupCompiler() { Blade::extend(function ($value, $compiler) { BladePlaceholder::setBladeTags($this->getBladeTags($compiler)); $context = new MinifyContext(new PlaceholderContainer()); $minifier = $this->laravel->make('blade.compiler.min'); $this->minifyContext = $minifier->run($context->setContents($value), $this->option()); return $this->minifyContext->getContents(); }); }
/** * Bootstrap any application services. * * @return void */ public function boot(Factory $validator) { require_once app_path() . '/validators.php'; Blade::directive('role', function ($expression) { return "<?php if(Auth::check() && Auth::user()->hasRole{$expression}): ?>"; }); Blade::directive('endrole', function ($expression) { return "<?php endif ?>"; }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { $this->publishes([__DIR__ . '/config/tabmenu.php' => config_path('tabmenu.php')]); Blade::directive('menu', function () { return "<?= app('DNABeast/TabMenu/TabMenu')->build('"; }); Blade::directive('endmenu', function () { return "');?>"; }); }
/** * Register the Blade directive for Blocks. */ 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(); ?>"; } }); }
/** * Bootstrap any application services. * * @return void */ public function boot(Kernel $kernel) { Blade::directive('cache', function ($expression) { return "<?php if(! app('JoeriAben\\BladeCache\\Tags')->open{$expression}): ?>"; }); Blade::directive('endcache', function () { return "<?php endif; echo app('JoeriAben\\BladeCache\\Tags')->close() ?>"; }); $this->publishes([__DIR__ . '/../config/bladecache.php' => $this->app->configPath() . '/' . 'bladecache.php'], 'config'); $kernel->pushMiddleware('JoeriAben\\BladeCache\\Middleware'); }
public function boot() { $this->package('skovachev/lacore'); Validator::resolver(function ($translator, $data, $rules, $messages) { return new \Skovachev\Lacore\Extensions\Validator($translator, $data, $rules, $messages); }); Blade::extend(function ($view) { $html = "<div id='message' class='alert <?php echo (Session::has('message-status') ? 'alert-' . Session::get('message-status') : ''); ?>'><?php echo Session::get('message'); ?></div>"; return str_replace("@message", $html, $view); }); }
/** * Registers the closing directives * @return void */ protected function registerClosingDirectives() { Blade::directive('endrole', function () { return "<?php endif; // app('laratrust')->hasRole ?>"; }); Blade::directive('endpermission', function () { return "<?php endif; // app('laratrust')->can ?>"; }); Blade::directive('endability', function () { return "<?php endif; // app('laratrust')->ability ?>"; }); }
/** * Register meta blade extensions . * */ protected function registerBladeExtension() { if ($this->versionMatch('5.0')) { Blade::extend(function ($view) { return str_replace("@meta", app('meta')->render(), $view); }); } elseif ($this->versionMatch('5.1')) { Blade::directive('meta', function ($expression) { return app('meta')->render($expression); }); } }
/** * Register the service provider. * * @return void */ public function register() { // Register the piwik tracker object $this->app['piwiktracker'] = $this->app->share(function () { return new PiwikTracker(); }); // Insert the piwik tracker code when we discover a @piwiktracker // directive in a template Blade::extend(function ($view, $compiler) { $pattern = $compiler->createPlainMatcher('piwiktracker'); return preg_replace($pattern, '<?php echo PiwikTracker::getCode() ?>', $view); }); }
public function register() { $this->app['prettyDump'] = $this->app->share(function ($app) { return new Dumper(); }); $this->app->booting(function () { AliasLoader::getInstance()->alias('PrettyDump', 'kotchuprik\\PrettyDump\\Facade'); }); Blade::extend(function ($view, $compiler) { $pattern = $compiler->createMatcher('prettyDump'); return preg_replace($pattern, '$1<?php PrettyDump::dump$2 ?>', $view); }); }
/** * Create a new instance * * @param ApiServer $apiServer * @param Sentry $sentry * @return void */ public function __construct(ApiServer $apiServer, Sentry $sentry, Excel $excel) { $this->apiServer = $apiServer; $this->sentry = $sentry; $this->excel = $excel; Blade::extend(function ($view) { return preg_replace(array('#@translate\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@translate\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Translate::t("$1")', 'Translate::t(\'$1\')'), $view); }); Blade::extend(function ($view) { return preg_replace(array('#@option\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@option\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Option::getAttribute("$1")', 'Option::getAttribute("$1")'), $view); }); $this->getLocale()->t('ebri'); }