- What is maize-tech/laravel-excludable used for?
- Laravel Excludable is a small Laravel package that provides an Eloquent trait for excluding model records from queries by default. You can hide records globally and include them on demand through query scopes. It is intended as an application-level utility, not a core platform dependency.
- How do I install laravel-excludable in a Laravel app?
- Install it with Composer using the package name maize-tech/laravel-excludable. Then add the provided trait to the Eloquent models you want to make excludable and wire any configuration as described in the package documentation. Run your test suite after installation to confirm query behavior.
- Does laravel-excludable support Laravel 11?
- Version 4.1.0 adds explicit Laravel 11.x compatibility via PR #30. The release notes do not state Laravel 12 support, so verify Composer constraints before assuming it works on newer Laravel versions. Check the package's test matrix for PHP and database coverage.
- How do I hide model records by default with laravel-excludable?
- Add the package's excludable trait to the model whose records you want hidden from Eloquent queries by default. Once wired, normal queries should exclude those records unless you explicitly include them. Validate the exact trait name and setup against the package docs and code before rollout.
- How can I include excluded records in an Eloquent query?
- The package provides scopes that let you include excluded records on demand rather than globally. Use the documented inclusion scope on the query builder for the model. Add focused tests to confirm included and excluded results match your expectations.
- Does laravel-excludable work with soft deletes and global scopes?
- The package operates at the Eloquent query level, so it can compose with soft deletes and existing global scopes, but the exact interaction must be validated. Global query modifications can change which records are visible in authorization, reporting, and data-integrity paths. Test representative models and queries before production use.
- Is there configuration for laravel-excludable?
- Adoption is typically a Composer dependency plus trait wiring, and any required configuration should follow the package documentation. The release notes for 4.1.0 do not describe new configuration options. Confirm whether a config file or service provider registration is required for your version.
- How do I test exclusion behavior in laravel-excludable?
- Write contract tests around the models where you apply the trait. Assert that default queries exclude records and that inclusion scopes return them correctly. Also test authorization and reporting queries that depend on data visibility.
- What are the production risks of using laravel-excludable?
- The main risk is unintended record exclusion or inclusion, which can affect authorization, reporting, and data integrity. Exclusion logic is query-level, so validate performance and query plans on high-volume tables. Roll out behind a feature flag or limited model scope and monitor for data-access anomalies.
- Who maintains laravel-excludable and is it actively supported?
- It is maintained by maize-tech as a small open-source Laravel package with community and GitHub support expected. No vendor SLA is indicated, so assign an internal owner to track Laravel and PHP compatibility releases. Keep a local fallback or removal plan for future upgrades.