H
H
hollanditkzn2017-04-03 12:36:20
Yii
hollanditkzn, 2017-04-03 12:36:20

How to specify in the role that the button is not shown?

I have a problem, there are active and inactive records in the database, the action line is responsible for this in the
database
That's about what I implemented this one, but I have it constantly highlighted.

<?php if (Yii::$app->user->can('admin', [Zakaz::find()->where(['active' => 0])])) { ?>
        <?= Html::a('Восстановить заказ', ['restore', 'id' => $model->id_zakaz], ['class' => 'btn btn-primary pull-right',
            'data' => [
                'confirm' => 'Вы действительно хотите восстановить заказ',
                'method' => 'post',
            ],
            ]) ?>  
        <?php } ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-04-04
@hollanditkzn

This
implies that there is an admin rule and there is some logic in it. in which you transfer Zakaz::find()->where(['active' => 0])]So it would be necessary to show this logic.
But I'm very embarrassed, Zakaz::find()->where(['active' => 0])probably not enough ->one()at the end, although again, without seeing the logic, it's hard to say.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question