PHP code example of sadi01 / yii2-bi-dashboard

1. Go to this page and download the library: Download sadi01/yii2-bi-dashboard 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/ */

    

sadi01 / yii2-bi-dashboard example snippets


return [
    //....
    'modules' => [
        'bidashboard' => [
            'class' => 'sadi01\bidashboard\Module',
        ],
    ]
];

php yii migrate --migrationPath=@sadi01/bidashboard/migrations

'controllerMap' => [
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationNamespaces' => [],
        'migrationPath' => [
            '@vendor/sadi01/yii2-bi-dashboard/src/migrations',
            '@app/migrations'
        ]
    ],
],

use sadi01\bidashboard\widgets\ReportModalWidget;

<?= ReportModalWidget::widget([
    'queryParams' => $queryParams,
    'searchModel' => $searchModel,
    'searchModelMethod' => $searchWidget,
    'searchModelRunResultView' => $searchModelRunResultView,
    'searchRoute' => Yii::$app->request->pathInfo,
    'searchModelFormName' => $searchModelFormName,
    'outputColumn' => $outputColumn,
]) 

public function searchWidget(array $params,int $rangeType,int $startRange,int $endRange)
{
    $query = Invoice::find();
    $dataProvider = new ActiveDataProvider([
        'query' => $query,
    ]);
    $this->load($params, '');
    $query->andFilterWhere(['between', 'created_at', $startRange, $endRange]);
    if ($rangeType == ReportWidget::RANGE_TYPE_MONTHLY) {
    ...
     }
    elseif ($rangeType == ReportWidget::RANGE_TYPE_DAILY) {
    ...    
    }
    return $dataProvider;
}