Passed
Push — master ( 5d7723...f7e125 )
by Paweł
03:17
created

FavoriteController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A actionDelete() 0 3 1
A behaviors() 0 7 1
1
<?php
2
/**
3
 * Created for IG Monitoring.
4
 * User: jakim <[email protected]>
5
 * Date: 27.02.2018
6
 */
7
8
namespace app\modules\admin\controllers;
9
10
11
use app\models\Favorite;
12
use yii\filters\VerbFilter;
13
use yii\helpers\ArrayHelper;
14
use yii\web\Controller;
15
16
class FavoriteController extends Controller
17
{
18
    public function behaviors()
19
    {
20
        return ArrayHelper::merge(parent::behaviors(), [
21
            'verb' => [
22
                'class' => VerbFilter::class,
23
                'actions' => [
24
                    'delete' => ['POST'],
25
                ],
26
            ],
27
        ]);
28
    }
29
30
    public function actionDelete($id)
31
    {
32
        Favorite::deleteAll(['id' => $id]);
33
    }
34
}