1 | <?php |
||
16 | use Yii; |
||
17 | |||
18 | class DashboardItem extends Menu |
||
19 | { |
||
20 | protected ClientWithCounters $clientWithCounters; |
||
|
|||
21 | |||
22 | public function __construct(ClientWithCounters $clientWithCounters, $config = []) |
||
23 | { |
||
24 | $this->clientWithCounters = $clientWithCounters; |
||
25 | parent::__construct($config); |
||
26 | } |
||
27 | |||
28 | public function items() |
||
29 | { |
||
30 | return Yii::$app->user->can('ticket.read') ? [ |
||
31 | 'ticket' => [ |
||
32 | 'label' => $this->render('dashboardItem', array_merge($this->clientWithCounters->getWidgetData('ticket'), [ |
||
33 | 'route' => Url::toRoute('@ticket/index'), |
||
34 | ])), |
||
35 | 'encode' => false, |
||
36 | ], |
||
37 | ] : []; |
||
40 |