Passed
Push — master ( 506560...11b166 )
by Loban
01:56
created

SettingsController::actionIndex()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 2
nop 0
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace example\controllers;
4
5
use Yii;
6
use yii\web\Controller;
7
use example\models\SettingsForm;
8
9
class SettingsController extends Controller
10
{
11
    public function actionIndex()
12
    {
13
        $model = new SettingsForm();
14
15
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
16
            Yii::$app->getSession()->setFlash('success', 'Settings successfully updated!');
17
            return $this->refresh();
18
        }
19
20
        return $this->render('settings', [
21
            'model' => $model,
22
        ]);
23
    }
24
}