Conditions | 3 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function run() |
||
25 | { |
||
26 | $url = Url::to(['/admin/account/dashboard', 'id' => $this->model->id]); |
||
27 | |||
28 | $model = Favorite::findOne([ |
||
29 | 'user_id' => Yii::$app->user->id, |
||
30 | 'url' => $url, |
||
31 | ]); |
||
32 | |||
33 | return AjaxButton::widget([ |
||
34 | 'confirm' => isset($model), |
||
35 | 'text' => $model ? $this->removeLabel : $this->addLabel, |
||
|
|||
36 | 'url' => $model ? ['favorite/delete', 'id' => $model->id] : ['favorite/create'], |
||
37 | 'data' => [ |
||
38 | 'url' => $url, |
||
39 | 'label' => $this->model->usernamePrefixed, |
||
40 | ], |
||
41 | 'options' => [ |
||
42 | 'class' => 'btn btn-block btn-default btn-sm', |
||
43 | 'data' => [ |
||
44 | 'style' => 'zoom-out', |
||
45 | ], |
||
49 | } |