Example #1
0
 /**
  * @return mixed
  */
 public function tenants()
 {
     $this->columns = array_merge($this->columns, [['label' => 'Tenants', 'value' => function ($model, $key, $index, $column) {
         $count = TenantUser::find()->joinWith(['user.auth'])->andWhere(['{{%auth}}.source_id' => $model['user_id']])->count();
         return $count > 0 ? Yii::$app->formatter->asDecimal($count, 0) : '';
     }, 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center']]]);
     return $this;
 }