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

FavoriteController::actionDelete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
}