PHP code example of pingslayer / laravel-go-reports

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

    

pingslayer / laravel-go-reports example snippets


use LaravelGoReports\JSONReport;
use App\Models\User;

return JSONReport::fromEloquent(
    User::join('orders', 'users.id', '=', 'orders.user_id')
        ->where('orders.status', 'paid')
);

use LaravelGoReports\JSONReport;
use Illuminate\Support\Facades\DB;

return JSONReport::fromEloquent(
    DB::table('reports')->where('amount', '>', 500)
);

use LaravelGoReports\JSONReport;

return JSONReport::generate([
    'sql' => 'SELECT * FROM reports WHERE amount > ?',
    'bindings' => [500]
]);

return [
    'auto_start' => env('REPORT_ENGINE_AUTO_START', true),
    'port'       => env('REPORT_ENGINE_PORT', 8081),
    'secret_key' => env('REPORT_ENGINE_SECRET', 'laravel-go-sync'),
];
bash
php artisan vendor:publish --provider="LaravelGoReports\LaravelGoReportsServiceProvider" --tag="config"