-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel 5.1 error #7
Comments
can't get it... |
Hi @younes0, What problem are you facing? Blade seems to of had a bit of an overhaul with 5.1 and the extend method has been altered. Mainly due to the removal of the You can get over this with a small change by copying the regex patterns into your own code and do something like this in the service provider for instance: public function boot()
{
Blade::extend(function($view, $compiler) {
$pattern = $this->createMatcher('directiveName');
});
}
protected function createMatcher($function)
{
return '/(?<!\w)(\s*)@'.$function.'(\s*\(.*\))/';
} If however you'd rather upgrade properly, the directive method essentially does some of the heavy lifting for you as seen in the docs. The example in the docs will replace @datetime($foo) with the returned value, saving you from having to do the matching. |
Thanks @dbonner1987 for your help, I used a dirty workaround by duplicating BladeCompiler class and adding the removed create*Matcher methods. I couldn't convert this to the new format: return preg_replace(
$pattern,
'$1<?php $__env->renderPartial$2, get_defined_vars(), function($file, $vars) use ($__env) {
$vars = array_except($vars, array(\'__data\', \'__path\'));
extract($vars); ?>',
$value
); I will look into this further later or make a PR based on your solution:https://github.com/Arrilot/laravel-widgets/blob/master/src/ServiceProvider.php#L119 |
I'll try and look into this issue this week. Thanks for the report. |
Is there a cleaner solution to this yet? |
Had there been any progress on this for Laravel 5.2? |
I have managed relative include using Blade::directive on Laravel 5.4, I think other version 5 may work, here is the gist https://gist.github.com/ciptohadi-web-id/91a4ca34ed0f5d1ce15c8a66ee36c284 |
With the new release, I get:
I'm investigating this
The text was updated successfully, but these errors were encountered: