title = '登录日志'; ?>

title) ?>


$dataProvider, 'columns' => [ [ 'attribute' => 'user_id', 'label' => '试图登录的账户', 'format' => 'html', // 设置格式为 HTML 'value' => function ($model) { return nl2br($model->user_id ? $model->user->username."\n(ID:".$model->user_id.')' : '不存在的用户'); }, ], [ 'attribute' => 'ip_address', 'label' => 'IP地址', 'format' => 'raw', 'value' => function ($model) { return Html::a($model->ip_address, 'https://ipinfo.io/'.$model->ip_address, ['target' => '_blank']); }, ], [ 'attribute' => 'login_time', 'label' => '登录时间', 'format' => 'html', 'enableSorting' => false, 'value' => function ($model) { return nl2br($model->login_time . "\n(" . Yii::$app->formatter->asRelativeTime($model->login_time) . ")"); }, ], [ 'attribute' => 'user_agent', 'label' => 'User Agent', ], [ 'attribute' => 'status', 'label' => '登录状态', 'format' => 'html', // 设置格式为 HTML 'value' => function ($model) { return $model->status === 1 ? '成功' : '失败'; }, ], ], 'pager' => [ 'class' => LinkPager::class, ], ]); ?>