mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
/* @var $this \yii\web\View */
|
|
/* @var $dataProvider \yii\data\ActiveDataProvider */
|
|
|
|
use yii\grid\GridView;
|
|
use app\models\UserFingerprint;
|
|
use \app\models\User;
|
|
use \yii\helpers\ArrayHelper;
|
|
|
|
echo GridView::widget([
|
|
'dataProvider' => $dataProvider,
|
|
'columns' => [
|
|
'hash',
|
|
[
|
|
'attribute' => 'user_ids',
|
|
'header' => 'Пользователи',
|
|
'value' => function ($data) {
|
|
$userIds = trim(ArrayHelper::getValue($data, 'user_ids'), '{}');
|
|
$userIds = preg_split('/,/', $userIds);
|
|
$users = User::find()->where(['id' => $userIds])->all();
|
|
return join(', ', ArrayHelper::getColumn($users, 'email'));
|
|
}
|
|
],
|
|
[
|
|
'attribute' => 'ips',
|
|
'header' => 'IP адреса',
|
|
'value' => function ($data) {
|
|
$ips = trim(ArrayHelper::getValue($data, 'ips'), '{}');
|
|
$ips = preg_split('/,/', $ips);
|
|
return join(', ', $ips);
|
|
}
|
|
],
|
|
]
|
|
]);
|