Skip to content
Snippets Groups Projects
Commit a2819213 authored by Kevin Hill's avatar Kevin Hill
Browse files

Added missing paren to end of directive and defensively remove () if present. Fixes #155

parent d6c3a8a5
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -41,18 +41,21 @@ $charts = [
'TableChart'
];
 
foreach ($charts as $chart) {
if (method_exists($blade, 'directive')) {
// Laravel 5
 
if (method_exists($blade, 'directive')) {
// Laravel 5
$blade->directive(strtolower($chart), function ($expression) use ($chart) {
$expression = ltrim($expression, '(');
$expression = rtrim($expression, ')');
 
return "<?php echo Lava::render('$chart', $expression; ?>";
return "<?php echo \Lava::render('$chart', $expression); ?>";
});
} else {
// Laravel 4
 
// Laravel 4
$blade->extend(
function ($view, $compiler) use ($chart) {
$pattern = $compiler->createMatcher(strtolower($chart));
Loading
Loading
@@ -61,5 +64,6 @@ foreach ($charts as $chart) {
return preg_replace($pattern, $output, $view);
}
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment