Download the PHP
package maize-tech/laravel-excludable without Composer
On this page you can find all versions of the php package
maize-tech/laravel-excludable. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.
Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.
In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories.
In this case some credentials are needed to access such packages.
Please use the auth.json textarea to insert credentials, if a package is coming from a private repository.
You can look here for more information.
Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
To use Composer is sometimes complicated. Especially for beginners.
Composer needs much resources. Sometimes they are not available on a simple webspace.
If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
# Laravel Excludable
[](https://packagist.org/packages/maize-tech/laravel-excludable)
[](https://github.com/maize-tech/laravel-excludable/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/maize-tech/laravel-excludable/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[](https://packagist.org/packages/maize-tech/laravel-excludable)
Easily exclude model entities from eloquent queries.
This package allows you to define a subset of model entities that should be excluded from eloquent queries.
You will be able to override the default `Exclusion` model and its associated migration, so you can eventually restrict the exclusion context by defining the entity that should effectively exclude the subset.
An example usage could be an application with a multi tenant scenario and a set of global entities.
While those entities should be accessible by all tenants, some of them might want to hide a subset of those entities for their users.
You can find an example in the [Usage](#usage) section.
## Installation
You can install the package via composer:
You can publish and run the migrations with:
You can publish the config file with:
This is the content of the published config file:
## Usage
### Basic
To use the package, add the `Maize\Excludable\Excludable` trait to all models you want to make excludable.
Here's an example model including the `Excludable` trait:
Now you can just query for a specific article entity and mark it as excluded.
That's all!
The package will add the given entity to the exclusions table, so all article related queries will exclude it.
### Exclude all model entities
To exclude all entities of a specific model you can use the `excludeAllModels` method:
The given method will create an Exclusion entity with a wildcard, which means all newly created entities will be excluded too.
You can also provide a subset of entities which should not be excluded:
To check whether a specific model has a wildcard or not you can use the `hasExclusionWildcard` method:
### Include all model entities
To re-include all entities of a specific model you can use the `includeAllModels` method:
The given method will delete all Exclusion entities related to the Article model.
### Include excluded entities
### Only show excluded entities
### Event handling
The package automatically throws two separate events when excluding an entity:
- `excluding` which is thrown before the entity is actually excluded.
This could be useful, for example, with an observer which listens to this event and does some sort of 'validation' to the related entity.
If the given validation does not succeed, you can just return `false`, and the entity will not be excluded;
- `excluded` which is thrown right after the entity has been marked as excluded.
## Testing
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](https://github.com/maize-tech/.github/blob/main/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](https://github.com/maize-tech/.github/security/policy) on how to report security vulnerabilities.
## Credits
- [Enrico De Lazzari](https://github.com/enricodelazzari)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
All versions of laravel-excludable with dependencies
Composer command for our command line client (download client)This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free.Standard composer command
The package maize-tech/laravel-excludable contains the following files
Loading the files please wait ....
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.