- Can I use this bundle directly in a Laravel project, or is it strictly for Symfony?
- This bundle is designed for Symfony but can be adapted for Laravel with bridges like `spatie/laravel-symfony-support` or by integrating Symfony’s HTTP Kernel. You’ll need to handle routing, dependency injection, and Twig/Blade compatibility manually, as Laravel’s ecosystem differs from Symfony’s.
- How do I create a custom widget in Laravel with this bundle?
- Use the `make:widget` or `make:workflow-widget` console commands to generate a widget class extending `AbstractWidget`. Implement `render()`, `getName()`, and `supports()` methods. For Laravel, ensure your widget logic aligns with Eloquent (not Doctrine) and use Blade/Twig bridges for templating.
- What Laravel versions does this bundle support?
- The bundle itself targets Symfony, but Laravel compatibility depends on your setup. Laravel 8+ is recommended for Symfony bridge packages. Test thoroughly, as Doctrine ORM (Symfony’s default) may conflict with Eloquent unless abstracted.
- How do I configure role-based widget visibility in Laravel?
- Override the `supports()` method in your widget class to check user roles using `$this->security->getUser()`. In Laravel, bind the Symfony `security` service to Laravel’s container or use a custom guard. Example: `return $user->hasRole(['admin']);`.
- Does this bundle work with Laravel’s Blade templating, or is Twig required?
- Twig is the default, but you can use a bridge like `twig/bridge` to render Twig templates in Blade. Alternatively, inline Twig rendering is possible but less performant. For pure Blade, rewrite widget templates manually or use a hybrid approach with Symfony’s Twig in a subdirectory.
- How do I cache widget data in Laravel’s cache system (Redis, file) instead of Symfony’s cache?
- Symfony’s cache uses PSR-6, but Laravel’s cache drivers (Redis, file) can integrate via adapters like `symfony/cache` with Laravel’s cache store. Override the widget’s cache logic or configure a custom cache pool in the bundle’s services.
- What’s the best way to handle database migrations for the widgets table in Laravel?
- Run the provided Symfony migration (`php bin/console make:migration`) but adapt it for Laravel’s Eloquent schema. Replace Doctrine-specific syntax (e.g., `QueryBuilder`) with Eloquent queries. Use `php artisan migrate` after modifying the migration file.
- Can I use Symfony UX Chartjs for dynamic charts in Laravel, or should I switch to a Laravel-native library?
- Symfony UX Chartjs can work in Laravel via standalone inclusion, but compatibility isn’t guaranteed. Alternatives like `laravel-chartjs` or `apexcharts` may require less effort. Test both: Symfony UX for advanced features, Laravel-native for simplicity.
- How do I create a static dashboard (non-database-backed) in Laravel?
- Implement `StaticWidgetProviderInterface` to define static widgets. In Laravel, register the provider in a service provider using `bindTagged()` or manually bind it. Static widgets bypass the database and render directly from templates.
- What are common issues when integrating this bundle with Laravel, and how do I debug them?
- Common issues include 404 errors (check `routes.yaml` vs. Laravel’s `web.php`), missing widgets (verify `supports()` roles and cache), and Twig/Blade conflicts. Debug with `php artisan route:list` (routes), `php artisan cache:clear`, and check Symfony’s `var/log/dev.log` for errors.