PHP code example of karataserkan / yii2-multi-dataprovider
1. Go to this page and download the library: Download karataserkan/yii2-multi-dataprovider 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/ */
karataserkan / yii2-multi-dataprovider example snippets
use karataserkan\yii2MultiDataProvider\MultiDataProvider;
$data1 = new ActiveDataProvider([
'query' => $query,
]);
$data2 = new ArrayDataProvider([
'allModels' => [...],
]);
$dataProvider = new MultiDataProvider([
'dataProviders' => [$data1,$data2],
]);
$dataProvider = new MultiDataProvider([
'dataProviders' => [$data1,$data2],
'modelCallback' => function ($model) {
return new YourModel(['data' => $model]);
},
]);