2017 © Pedro Peláez
 

library reports

UI for created and download reports in Laravel

image

agoalofalife/reports

UI for created and download reports in Laravel

  • Thursday, June 7, 2018
  • by agoalofalife
  • Repository
  • 1 Watchers
  • 5 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 180 % Grown

The README.md

REPORTS

, (*1)

, (*2)

Requirements : PHP verison >= 7.1.0 Laravel version >= 5.5, (*3)

not support Laravel version 5.8 & >

What is it?

This is package offers ready UI and some code, for reports., (*4)

Reports will be with extensions: pdf, xlxs, xls, csv ., (*5)

In the paradigm Laravel, we make reprots and write code. It's just!, (*6)

Install

composer require agoalofalife/reports
php artisan reports:install

Locale

In file config/app.php select your language., (*7)

The package provides two languages: - ru - en, (*8)

Blade and UI

In your template, you need to paste the code, (*9)

  <body>
    @include('reports::app')
    ...

Cron

You have to add cron, how separete process., (*10)

// App\Console\Kernel
use agoalofalife\Reports\Console\ParseReportsCommand;

  $schedule->command(ParseReportsCommand::class)->everyMinute();

The development process

You create new file report:, (*11)

php artisan make:report NameReport

Insert in config config/reports.php :, (*12)


'reports' => [ \App\Reports\TestReport::class ],

Fill the class:, (*13)

<?php
declare(strict_types=1);
namespace App\Reports;

use agoalofalife\Reports\Contracts\HandlerReport;
use agoalofalife\Reports\Report;

class TestReport extends Report implements HandlerReport
{
    /**
     * Disk for filesystem
     * @var string
     */
    public $disk = 'public';

  /**
     * Format export : xls, xlsx, pdf, csv
     * @var string
     */
    public $extension = 'xlsx';

     /**
     * Get file name
     * @return string
     */
    public function getFilename() : string
    {
        return 'TestReport';
    }

    /**
     * Get title report
     * @return string
     */
    public function getTitle() : string
    {
        return 'Test';
    }

    /**
     * Get description report
     * @return string
     */
    public function getDescription() : string
    {
        return 'Description test report';
    }

    /**
     * @param $excel
     * @return bool
     */
    public function handler($excel) : bool
    {
      $excel->sheet('Sheetname', function ($sheet) {
            $sheet->rows(array(
                array('test1', 'test2'),
                array('test3', 'test4')
            ));
        });
      return true;
    }
}

Property $disk, name disk in filesystem., (*14)

Property $extension, type extension your file., (*15)

Method getFilename accordingly return name file., (*16)

Method getTitle return name title in UI., (*17)

Method getDescription return description in UI., (*18)

Method handler is base method. Package use external package., (*19)

Method is a small wrapper., (*20)

Notification

Once the report is ready, you can send notification., (*21)

For this you need to implement interface agoalofalife\Reports\Contracts\NotificationReport., (*22)

Method getNotifiable return notifiable, which has a method routeNotificationFor., (*23)

And method getNotification, return Notification type., (*24)

    // implements agoalofalife\Reports\Contracts\NotificationReport
    public function getNotifiable()
    {
        return User::where('email', 'test@gmail.com')->get()->first();
    }

    public function getNotification(): Notification
    {
        return new InvoicePaid();
    }
// app/User.php

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

The Versions

07/06 2018

dev-master

9999999-dev

UI for created and download reports in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar agoalofalife

laravel reports

07/06 2018

v0.2.2

0.2.2.0

UI for created and download reports in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar agoalofalife

laravel reports

31/05 2018

v0.2.1

0.2.1.0

UI for created and download reports in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar agoalofalife

laravel reports

12/03 2018

v0.2.0

0.2.0.0

UI for created and download reports in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar agoalofalife

laravel reports

12/03 2018

v0.1.0

0.1.0.0

UI for created and download reports in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar agoalofalife

laravel reports