PHP code example of reportkit / laravel-legacy

1. Go to this page and download the library: Download reportkit/laravel-legacy 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/ */

    

reportkit / laravel-legacy example snippets


'providers' => array(
    'ReportKit\\Laravel\\Legacy\\ReportKitServiceProvider',
),
'aliases' => array(
    'ReportKit' => 'ReportKit\\Laravel\\Legacy\\Facades\\ReportKit',
),

use ReportKit\Core\Source\MergedRowSource;
use ReportKit\Laravel\Legacy\Source\ConnectionRowSource;

$domain = function ($query, array $filters) {
    return $query->from('orders')
        ->whereBetween('created_at', array($filters['start_date'], $filters['end_date']));
};

$live    = new ConnectionRowSource('mysql', $domain, null, 'live');
$archive = new ConnectionRowSource('mysql_archive', $domain, null, 'archive');

$source = new MergedRowSource(array($live, $archive));
$source->dedupeBy('id')->orderBy('created_at', 'desc');

$rows = $source->getRows($filters); // merged + deduped + sorted