Skip to content

Commit e97a3f2

Browse files
committed
fix bug: when a CRLF is in @widget, blade will complains! It is not so friendly for long parameters.
1 parent 05dd039 commit e97a3f2

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/ServiceProvider.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,21 @@ public function boot()
7070
});
7171
}
7272

73-
$this->registerBladeDirective('widget', '$1<?php echo app("arrilot.widget")->run$2; ?>');
74-
$this->registerBladeDirective('async-widget', '$1<?php echo app("arrilot.async-widget")->run$2; ?>');
75-
$this->registerBladeDirective('asyncWidget', '$1<?php echo app("arrilot.async-widget")->run$2; ?>');
76-
$this->registerBladeDirective('widgetGroup', '$1<?php echo app("arrilot.widget-group-collection")->group$2->display(); ?>');
73+
Blade::directive('widget', function($expression){
74+
return "<?php echo app('arrilot.widget')->run{$expression}; ?>";
75+
});
76+
77+
Blade::directive('async-widget', function($expression){
78+
return "<?php echo app('arrilot.async-widget')->run{$expression}; ?>";
79+
});
80+
81+
Blade::directive('asyncWidget', function($expression){
82+
return "<?php echo app('arrilot.async-widget')->run{$expression}; ?>";
83+
});
84+
85+
Blade::directive('asyncWidget', function($expression){
86+
return "<?php echo app('arrilot.arrilot.widget-group-collection')->group{$expression}->display(); ?>";
87+
});
7788
}
7889

7990
/**

0 commit comments

Comments
 (0)