1. Go to this page and download the library: Download agoalofalife/reports library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
agoalofalife / reports example snippets
composer
php artisan reports:install
<body>
@
// App\Console\Kernel
use agoalofalife\Reports\Console\ParseReportsCommand;
$schedule->command(ParseReportsCommand::class)->everyMinute();
php artisan make:report NameReport
'reports' => [
\App\Reports\TestReport::class
],
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;
}
}
// implements agoalofalife\Reports\Contracts\NotificationReport
public function getNotifiable()
{
return User::where('email', '[email protected]')->get()->first();
}
public function getNotification(): Notification
{
return new InvoicePaid();
}
// app/User.php
public function routeNotificationForSlack($notification)
{
return 'hook';
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.