From d66b44a5858d52e2ff4b030dbdb4e23df78a4bf6 Mon Sep 17 00:00:00 2001 From: Konrad Kalemba Date: Fri, 13 Sep 2024 13:51:27 +0200 Subject: [PATCH] Add `$__bladeCompiler` to function uses --- src/BladeComponentsScopedSlotsServiceProvider.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/BladeComponentsScopedSlotsServiceProvider.php b/src/BladeComponentsScopedSlotsServiceProvider.php index d5955cd..8d3cba9 100644 --- a/src/BladeComponentsScopedSlotsServiceProvider.php +++ b/src/BladeComponentsScopedSlotsServiceProvider.php @@ -27,19 +27,20 @@ public function boot() // Connect the arguments to form a correct function declaration if ($functionArguments) $functionArguments = "function {$functionArguments}"; - + $functionUses = array_filter(explode(',', trim($functionUses, '()')), 'strlen'); - - // Add `$__env` to allow usage of other Blade directives inside the scoped slot + + // Add `$__env` and `$__bladeCompiler` to allow usage of other Blade directives inside the scoped slot array_push($functionUses, '$__env'); + array_push($functionUses, '$__bladeCompiler'); $functionUses = implode(',', $functionUses); - return "slot({$name}, {$functionArguments} use ({$functionUses}) { ?>"; + return "slot({$name}, {$functionArguments} use ({$functionUses}) { ?>"; }); Blade::directive('endscopedslot', function () { return ""; }); } -} \ No newline at end of file +}