https://github.com/always-open/report-engine
https://github.com/always-open/report-engine
hacktoberfest laravel reporting reports
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/always-open/report-engine
- Owner: always-open
- License: mit
- Created: 2021-06-17T18:46:23.000Z (about 5 years ago)
- Default Branch: 3.x
- Last Pushed: 2024-06-18T19:16:17.000Z (about 2 years ago)
- Last Synced: 2024-11-24T19:20:40.490Z (over 1 year ago)
- Topics: hacktoberfest, laravel, reporting, reports
- Language: PHP
- Homepage:
- Size: 142 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# General reporting engine for Laravel
[](https://packagist.org/packages/always-open/report-engine)
[](https://github.com/always-open/report-engine/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/always-open/report-engine/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[](https://packagist.org/packages/always-open/report-engine)
General reporting engine for Laravel
## Installation
You can install the package via composer:
```bash
composer require always-open/report-engine
```
## Usage
### Create a report
Create a report that extends the ReportBase. Within this class you will define the query to fetch the data as well as
the columns which will be output.
```php
select([
'id',
'email',
'name',
]);
}
/**
* @return array
*/
public function availableColumns(): array
{
return [
'name' => [
'label' => 'Name',
'filterable' => true,
'type' => new Text(),
],
'email' => [
'label' => 'Email',
'filterable' => true,
'type' => new Text(),
],
];
}
}
```
### Create a controller
Create a controller to output the report
```php
multiformat();
```
#### Routes
Multiformat adds handling multiple formats to the url which can give the following output building upon the above
examples.
This will output an HTML page that will contain a tabulator table and make ajax requests to get the data needed.
```
{{ base_url }}/users
```
This will output a JSON payload of the data
```
{{ base_url }}/users.json
```
This will output the entire SQL query, useful for debugging
```
{{ base_url }}/users.sql
```
This will return the output of the explain command for the query, useful for debugging
```
{{ base_url }}/users.explain
```
## Filters
Here are the possible filters for the default types. To build a filter follow this format:
```javascript
let filterParams = new URLSearchParams();
let filterName = 'name'
let action = 'equals'
let value = 'bob'
filterParams.append('filters['+filterName+']['+action+']', value)
```
### DateTime
- does_not_equal
- equals
- greater_than
- greater_than_or_equal
- less_than
- less_than_or_equal
### Decimal
- does_not_equal
- equals
- greater_than
- greater_than_or_equal
- less_than
- less_than_or_equal
### Dollar
- does_not_equal
- equals
- greater_than
- greater_than_or_equal
- less_than
- less_than_or_equal
### Enum
- equals
### Html
- contains
- does_not_contain
### Integer
- does_not_equal
- equals
- greater_than
- greater_than_or_equal
- less_than
- less_than_or_equal
### NullableDecimal
- does_not_equal
- equals
- greater_than
- greater_than_or_equal
- is_empty
- is_not_empty
- less_than
- less_than_or_equal
### NullableInteger
- does_not_equal
- equals
- greater_than
- greater_than_or_equal
- is_empty
- is_not_empty
- less_than
- less_than_or_equal
### Number
- does_not_equal
- equals
- greater_than
- greater_than_or_equal
- less_than
- less_than_or_equal
### NumericHtml
- does_not_equal
- equals
- greater_than
- greater_than_or_equal
- less_than
- less_than_or_equal
### Percentage
- does_not_equal
- equals
- greater_than
- greater_than_or_equal
- less_than
- less_than_or_equal
### Text
- contains
- does_not_contain
- does_not_equal
- equals
### Url
- contains
- does_not_contain
### YesNo
- is_true
- is_false
### YesNoShort
- is_true
- is_false
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [AlwaysOpen](https://github.com/always-open)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.