Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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.php

public function routeNotificationForSlack($notification)
{
return 'hook';
}
```