Code Duplication    Length = 28-28 lines in 2 locations

src/menus/BillDetailMenu.php 1 location

@@ 15-42 (lines=28) @@
12
13
use Yii;
14
15
class BillDetailMenu extends \hipanel\menus\AbstractDetailMenu
16
{
17
    public $model;
18
19
    public function items()
20
    {
21
        $actions = BillActionsMenu::create(['model' => $this->model])->items();
22
        $items = array_merge($actions, [
23
            'delete' => [
24
                'label' => Yii::t('hipanel', 'Delete'),
25
                'icon' => 'fa-trash',
26
                'url' => ['@bill/delete', 'id' => $this->model->id],
27
                'encode' => false,
28
                'linkOptions' => [
29
                    'data' => [
30
                        'confirm' => Yii::t('hipanel', 'Are you sure you want to delete this item?'),
31
                        'method' => 'POST',
32
                        'pjax' => '0',
33
                    ],
34
                ],
35
                'visible' => Yii::$app->user->can('bill.delete'),
36
            ],
37
        ]);
38
        unset($items['view']);
39
40
        return $items;
41
    }
42
}
43

src/menus/PriceDetailMenu.php 1 location

@@ 15-42 (lines=28) @@
12
13
use Yii;
14
15
class PriceDetailMenu extends \hipanel\menus\AbstractDetailMenu
16
{
17
    public $model;
18
19
    public function items()
20
    {
21
        $actions = PriceActionsMenu::create(['model' => $this->model])->items();
22
        $items = array_merge($actions, [
23
            'delete' => [
24
                'label' => Yii::t('hipanel', 'Delete'),
25
                'icon' => 'fa-trash',
26
                'url' => ['@price/delete', 'id' => $this->model->id],
27
                'encode' => false,
28
                'linkOptions' => [
29
                    'data' => [
30
                        'confirm' => Yii::t('hipanel', 'Are you sure you want to delete this item?'),
31
                        'method' => 'POST',
32
                        'pjax' => '0',
33
                    ],
34
                ],
35
                'visible' => true,
36
            ],
37
        ]);
38
        unset($items['view']);
39
40
        return $items;
41
    }
42
}
43