Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agoalofalife/reports
UI for created and download reports in Laravel
https://github.com/agoalofalife/reports
cron laravel laravel-package notifications report reports
Last synced: 3 months ago
JSON representation
UI for created and download reports in Laravel
- Host: GitHub
- URL: https://github.com/agoalofalife/reports
- Owner: agoalofalife
- License: mit
- Created: 2018-03-05T13:03:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-13T09:40:18.000Z (over 5 years ago)
- Last Synced: 2024-09-14T11:28:03.787Z (4 months ago)
- Topics: cron, laravel, laravel-package, notifications, report, reports
- Language: PHP
- Size: 1.59 MB
- Stars: 16
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
REPORTS
> Requirements :
PHP verison >= 7.1.0
Laravel version >= 5.5```
not support Laravel version 5.8 & >
```
### What is it?This is package offers ready UI and some code, for reports.
Reports will be with extensions: `pdf, xlxs, xls, csv` .
In the paradigm Laravel, we make reprots and write code. It's just!
### Install
```php
composer require agoalofalife/reports
``````php
php artisan reports:install
```### Locale
In file `config/app.php` select your language.
The package provides two languages:
- ru
- en### Blade and UI
In your template, you need to paste the code
```php
@include('reports::app')
...
```### Cron
You have to add cron, how separete process.```php
// App\Console\Kernel
use agoalofalife\Reports\Console\ParseReportsCommand;$schedule->command(ParseReportsCommand::class)->everyMinute();
```### The development process
You create new file report:
```php
php artisan make:report NameReport
```
Insert in config `config/reports.php` :
```php'reports' => [
\App\Reports\TestReport::class
],
```Fill the class:
```php
sheet('Sheetname', function ($sheet) {
$sheet->rows(array(
array('test1', 'test2'),
array('test3', 'test4')
));
});
return true;
}
}
```
Property `$disk`, name disk in filesystem.Property `$extension`, type extension your file.
Method `getFilename` accordingly return name file.
Method `getTitle` return name title in UI.
Method `getDescription` return description in UI.
Method `handler` is base method. Package use [external](https://github.com/Maatwebsite/Laravel-Excel) package.
Method is a small wrapper.
### Notification
Once the report is ready, you can send [notification](https://laravel.com/docs/5.5/notifications).
For this you need to implement interface `agoalofalife\Reports\Contracts\NotificationReport`.
Method `getNotifiable` return `notifiable`, which has a method `routeNotificationFor`.
And method `getNotification`, return `Notification` type.
```php
// implements agoalofalife\Reports\Contracts\NotificationReport
public function getNotifiable()
{
return User::where('email', '[email protected]')->get()->first();
}public function getNotification(): Notification
{
return new InvoicePaid();
}
```
```php
// app/User.phppublic function routeNotificationForSlack($notification)
{
return 'hook';
}
```