Download the PHP package view-components/eloquent-data-processing without Composer
On this page you can find all versions of the php package view-components/eloquent-data-processing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download view-components/eloquent-data-processing
More information about view-components/eloquent-data-processing
Files in view-components/eloquent-data-processing
Package eloquent-data-processing
Short Description Eloquent ORM support for ViewComponents
License MIT
Homepage https://github.com/view-components/eloquent-data-processing
Informations about the package eloquent-data-processing
ViewComponents\EloquentDataProcessing
Eloquent ORM support for ViewComponents
Table of Contents
- Requirements
- Installation
- Usage
- Contributing
- Testing
- Security
- License
Requirements
- PHP 5.5+ (hhvm & php7 are supported)
Installation
The recommended way of installing the component is through Composer.
Run following command:
Usage
Creating Data Provider
EloquentDataProvider supports 3 types of data sources:
- Illuminate\Database\Eloquent\Builder instance (database query builder created from model)
- Illuminate\Database\Query\Builder instance (standard database query builder, don't know about models)
- Class name of Eloquent model
Using Class Name of Eloquent Model as Data Source
If you use class name of Eloquent model as data source, the only way to modify database query is specifying data provider operations:
Using Illuminate\Database\Eloquent\Builder as Data Source
It's possible to specify query parts before creating EloquentDataProvider but note that some parts of query may be changed by data provider operations.
Using Illuminate\Database\Query\Builder as Data Source
It's possible to use EloquentDataProvider if you not deal with Eloquent models.
Data Provider Operations
Eloquent Data provider modifies database query when it has operations.
Use operations() method for accessing operations collection.
Documentation related to collections can be found here.
Example of adding operation:
Also operations can be specified on data provider creation:
Extracting data
Data providers implements IteratorAggregate interface, so you can iterate it like array:
Data provider executes DB query when getIterator() method is called or when iteration begins in case if data is not loaded yet, i. e. calling getIterator() twice will not produce 2 database queries. But changing operations collection will cause resetting cache:
Contributing
Please see Code of Conduct for details.
Testing
This package bundled with unit tests (PHPUnit).
To run tests locally, you must install this package as stand-alone project with dev-dependencies:
Command for running tests:
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
© 2015 — 2016 Vitalii Stepanenko
Licensed under the MIT License.
Please see License File for more information.