- How do I migrate from Filament’s static widgets to dynamic widgets?
- Extend your existing widgets with the `DynamicWidget` contract or use the `HasSizeDefaults` trait to minimize boilerplate. The package provides traits to handle common widget behaviors like resizing constraints. Start by adapting one widget in a staging environment to test compatibility before rolling out changes.
- Can I use this package with Filament v4 and v5 side-by-side?
- No, the package is designed for either Filament v4 or v5 but not both simultaneously. Ensure all your Filament resources and plugins are compatible with the version you’re targeting. The package explicitly supports v4.1.10+ and v5, so verify your Filament installation matches before proceeding.
- What happens if I exceed 50 widgets on a single dashboard? Will performance degrade?
- Performance may degrade with heavy dashboards due to JSON hydration and Livewire updates. To mitigate this, use Filament’s `shouldRender()` method to conditionally load widgets or implement lazy-loading for non-critical widgets. Benchmark your specific use case in a staging environment to identify thresholds.
- How do I create custom JSON layout templates beyond the 8 presets?
- Store custom JSON templates in `resources/json/dynamic-dashboard/layouts/` and reference them in your dashboard configuration. The package supports per-dashboard templates, so you can define unique layouts for different user roles or sections. Use the `DynamicDashboard` class to register these templates dynamically.
- Is there a way to restrict dashboard access without Spatie’s permission package?
- Yes, you can use Laravel’s built-in gates or policies to control dashboard visibility. The package provides hooks to integrate custom authorization logic, such as checking user roles or team memberships. For example, you can extend the `DynamicDashboard` class to override the `canView()` method.
- Will this package work with widgets that have complex state, like modals or collapsible sections?
- Yes, but you’ll need to ensure your widget implements the `DynamicWidget` contract methods for state management. For modals or collapsible sections, use the `shouldRender()` method to conditionally show/hide elements based on the widget’s state. Test these interactions thoroughly, as dynamic layouts may affect modal positioning.
- How do I handle version conflicts with GridStack.js if Filament updates its asset pipeline?
- Override GridStack’s styles or scripts via Filament’s asset pipeline by publishing the package’s assets and customizing them in your `resources/js` directory. Test in a staging environment to ensure no styling or behavior clashes occur after Filament updates. The package includes hooks for custom asset registration.
- What’s the rollback plan if the migration fails during an upgrade from v1.x?
- The upgrade from v1.x is irreversible due to schema changes, so always back up your database before running migrations. If the migration fails, restore from backup and review the changelog for v1.x to v2.x to identify potential issues. Test the upgrade in a non-production environment first.
- Can I track which dashboard layouts are most popular among users?
- Yes, you can log dashboard usage by extending the `DynamicDashboard` class and overriding methods like `afterSave()`. Use Laravel’s logging or analytics services to track metrics such as layout selection frequency. This data can inform future optimizations or template refinements.
- Are there any Filament widgets that cannot be adapted to dynamic layouts?
- Most Filament widgets can be adapted, but widgets with static method conflicts (e.g., hardcoded HTML or non-Livewire components) may require custom workarounds. Test widgets like `Table`, `Chart`, or `Form` first, as they’re commonly used and well-supported. For unsupported widgets, consider refactoring or replacing them with dynamic-compatible alternatives.