Issues (27)

backend/views/users/index.php (1 issue)

Labels
Severity
1
<?php
2
3
use yii\helpers\Html;
4
use yii\web\View;
5
use yii\grid\GridView;
6
use yii\data\ActiveDataProvider;
7
use backend\widgets\ButtonCreate;
8
use backend\models\User;
9
use backend\models\search\UserSearch;
10
use backend\components\grid\ActionColumn;
11
use backend\components\grid\EnumColumn;
12
13
/**
14
 * @var View $this
15
 * @var ActiveDataProvider $dataProvider
16
 * @var UserSearch $searchModel
17
 */
18
19
$this->title = 'Users';
20
$this->params['breadcrumbs'][] = $this->title;
21
?>
22
<div class="document-index">
23
    <p><?=ButtonCreate::widget([
24
        'label' => 'Create User',
25
        'link' => ['create'],
26
    ])?></p>
27
    <?php if (Yii::$app->session->hasFlash('success')) : ?>
0 ignored issues
show
The method hasFlash() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
    <?php if (Yii::$app->session->/** @scrutinizer ignore-call */ hasFlash('success')) : ?>

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
        <div class="alert alert-success alert-dismissable">
29
            <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
30
            <h4><i class="icon fa fa-check"></i>Saved!</h4>
31
            <?= Yii::$app->session->getFlash('success') ?>
32
        </div>
33
    <?php endif; ?>
34
    <?php echo GridView::widget([
35
        'dataProvider' => $dataProvider,
36
        //'filterModel' => $searchModel,
37
        'columns' => [
38
            'id',
39
            'username',
40
            [
41
                'class' => EnumColumn::class,
42
                'attribute' => 'status',
43
                'enum' => [
44
                    User::STATUS_ACTIVE => HTML::tag('span', 'active', ['class' => ['label', 'label-success']]),
45
                    User::STATUS_DELETED => HTML::tag('span', 'inactive', ['class' => ['label', 'label-default']]),
46
                ],
47
                'format' => 'raw',
48
            ],
49
            [
50
                'attribute' => 'created_at',
51
                'format' => 'date',
52
            ],
53
            [
54
                'attribute' => 'updated_at',
55
                'format' => 'date',
56
            ],
57
            [
58
                'class' => ActionColumn::class,
59
                'template' => '{view} {update} {delete}',
60
                'visibleButtons' => [
61
                    'delete' => function (User $user) {
62
                        return $user->isDeleteAllowed();
63
                    },
64
                ],
65
            ],
66
        ],
67
    ]); ?>
68
</div>
69