From 9bb1418c8f424ff7f588222713e78ef47c74f0b1 Mon Sep 17 00:00:00 2001 From: Saif Allah Khaled Date: Wed, 30 Oct 2024 12:43:00 +0300 Subject: [PATCH 1/2] Add register_blade_directives to config --- src/Config/themes.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/Config/themes.php b/src/Config/themes.php index 2b31d55..0e66511 100644 --- a/src/Config/themes.php +++ b/src/Config/themes.php @@ -2,16 +2,16 @@ return [ - /* - |-------------------------------------------------------------------------- - | Root path where theme Views will be located. - | Can be outside default views path e.g.: resources/themes - | Leave it null if you will put your themes in the default views folder - | (as defined in config\views.php) - |-------------------------------------------------------------------------- - */ + /* + |-------------------------------------------------------------------------- + | Root path where theme Views will be located. + | Can be outside default views path e.g.: resources/themes + | Leave it null if you will put your themes in the default views folder + | (as defined in config\views.php) + |-------------------------------------------------------------------------- + */ - 'themes_path' => null, // eg: base_path('resources/themes') + 'themes_path' => null, // eg: base_path('resources/themes') /* |-------------------------------------------------------------------------- @@ -40,6 +40,20 @@ 'cache' => false, + /* + |-------------------------------------------------------------------------- + | Laravel introduced the @js directive in Laravel 9, released on February 8, 2022. + | This directive was added to simplify safely passing PHP data to JavaScript + | within Blade templates, eliminating the need for manual JSON encoding and escaping, + | which was commonly done with json_encode() in older versions. + | + | which may conflict with you if you're (or package ex: filament) using it. + | so you might want to disabled registering this package @js @jsIn @css blade directives. + |-------------------------------------------------------------------------- + */ + + 'register_blade_directives' => true, + /* |-------------------------------------------------------------------------- | Define available themes. Format: From 251ac8f4e5490388329faadff3c6c51d5c86ec6d Mon Sep 17 00:00:00 2001 From: Saif Allah Khaled Date: Wed, 30 Oct 2024 12:43:45 +0300 Subject: [PATCH 2/2] Add Check for register_blade_directives config value (default to true) --- src/themeServiceProvider.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/themeServiceProvider.php b/src/themeServiceProvider.php index 774b577..1d6353c 100644 --- a/src/themeServiceProvider.php +++ b/src/themeServiceProvider.php @@ -87,7 +87,9 @@ public function boot() | Register custom Blade Directives |--------------------------------------------------------------------------*/ - $this->registerBladeDirectives(); + if(\Config::get('themes.register_blade_directives', true)) { + $this->registerBladeDirectives(); + } } protected function registerBladeDirectives()