Files
rspade_system/app/RSpade/Integrations/Jqhtml/JqhtmlServiceProvider.php
root f6fac6c4bc Fix bin/publish: copy docs.dist from project root
Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 02:08:33 +00:00

38 lines
1.2 KiB
PHP
Executable File

<?php
namespace App\RSpade\Integrations\Jqhtml;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use App\RSpade\Integrations\Jqhtml\JqhtmlBladeCompiler;
/**
* Jqhtml Service Provider
*
* Registers jqhtml components with Laravel's Blade component system
*/
#[Instantiatable]
class JqhtmlServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services
*/
public function boot(): void
{
// Register the Blade precompiler for uppercase jqhtml component tags
Blade::precompiler(function ($value) {
return JqhtmlBladeCompiler::precompile($value);
});
// Register the generic x-jqhtml component for kebab-case usage
Blade::component('jqhtml', \App\RSpade\Integrations\Jqhtml\Jqhtml_View_Component::class);
// Also register a Blade directive for simpler syntax
Blade::directive('jqhtml', function ($expression) {
// Parse the expression to extract component and args
// Example: @jqhtml('User_Card', ['name' => 'John'])
return "<?php echo \\App\\RSpade\\Integrations\\Jqhtml\\Jqhtml::component({$expression}); ?>";
});
}
}