mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
24 lines
637 B
PHP
24 lines
637 B
PHP
<?php
|
|
|
|
namespace Flasher\Laravel\ServiceProvider\Providers;
|
|
|
|
use Illuminate\Foundation\Application;
|
|
use Illuminate\Support\Facades\Blade;
|
|
|
|
final class Laravel50 extends Laravel
|
|
{
|
|
public function shouldBeUsed()
|
|
{
|
|
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '5.0');
|
|
}
|
|
|
|
public function registerBladeDirectives()
|
|
{
|
|
Blade::extend(function ($view, $compiler) {
|
|
$pattern = $compiler->createPlainMatcher('flasher_render(.*)');
|
|
|
|
return preg_replace($pattern, '$1<?php echo app(\'flasher.presenter.html\')->render($2); ?>', $view);
|
|
});
|
|
}
|
|
}
|