- How do I install act-training/query-builder in a Laravel project?
- Run `composer require act-training/query-builder` in your project root. The package integrates seamlessly with Laravel’s Eloquent models and requires no additional configuration for basic query-building. Ensure your Laravel version is 8.0 or higher for full compatibility.
- Does this package support Laravel 9 or 10?
- Yes, the package is designed for Laravel 8+ and explicitly supports Laravel 9 and 10. The Alpine.js column search feature is frontend-only and won’t conflict with backend Laravel updates. Always check the package’s GitHub for version-specific notes.
- How does the Alpine.js column search work in ReportBuilder?
- The Alpine.js-powered column search adds real-time filtering to column selection panels in `ReportBuilder` subclasses. It reduces server requests by handling filtering client-side. Enable it via `$enableColumnSearch = true` in your ReportBuilder configuration.
- Can I use this package without Alpine.js?
- Yes, the column search feature is optional. Set `$enableColumnSearch = false` in your ReportBuilder to disable it. The core query-building functionality remains fully operational without Alpine.js.
- Will this package work with Vue.js or React in my Laravel app?
- The core query builder works independently of frontend frameworks. However, the Alpine.js column search may require adjustments if your app uses Vue/React. You can either disable the feature or replicate its logic using your preferred framework’s directives.
- How do I test queries built with this package?
- Test queries using Laravel’s built-in testing tools like `assertDatabaseHas` or `assertSoftDeleted`. For ReportBuilder-specific tests, verify column filtering logic with PHPUnit and, if using Alpine.js, add frontend tests (e.g., Cypress or Playwright) to check real-time updates.
- Is there a performance impact in production?
- The package is optimized for performance. Alpine.js filtering happens client-side, so it won’t affect backend query execution. Ensure your underlying Eloquent queries are efficient, especially for large datasets, by leveraging Laravel’s query caching or database indexing.
- What alternatives exist for Laravel query builders?
- Alternatives include Laravel Scout (for search-heavy apps), Spatie’s Laravel Query Builder, or custom solutions using Eloquent’s fluent interface. This package stands out for its `ReportBuilder` integration and Alpine.js-enhanced UI, making it ideal for reporting tools.
- How do I customize the column search UI in ReportBuilder?
- Extend the `ReportBuilder` class and override the Alpine.js directives or Blade templates used for column selection. You can modify the search behavior, styling, or add custom validation logic while keeping the query-building logic intact.
- Does this package support multi-tenancy or scoped queries?
- The package doesn’t include built-in multi-tenancy support, but you can integrate it with Laravel’s global scopes or packages like Stancl/Tenant. Use Eloquent’s `globalScope` or middleware to apply tenant-specific constraints to queries built with this package.