Passed
Push — master ( db619f...0a9de2 )
by Ferry
04:28
created

DeveloperThemesController::getActiveTheme()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace crocodicstudio\crudbooster\controllers;
4
5
use crocodicstudio\crudbooster\exceptions\CBValidationException;
6
use crocodicstudio\crudbooster\helpers\Plugin;
7
use Doctrine\DBAL\Query\QueryException;
8
use Illuminate\Support\Facades\DB;
9
10
class DeveloperThemesController extends Controller
11
{
12
    private $view = "crudbooster::dev_layouts.modules.themes";
13
14
    public function __construct()
15
    {
16
        view()->share(['page_title'=>'Themes']);
17
    }
18
19
    public function getIndex() {
20
        $themes = (new Plugin())->getAllThemes();
21
        $data = [];
22
        $data['result'] = $themes;
23
        return view($this->view.".index",$data);
24
    }
25
26
    public function getActiveTheme($theme_path) {
27
        $theme_path = base64_decode($theme_path);
28
        putSetting("theme_path", $theme_path);
29
        return cb()->redirectBack("Theme has been activated!","success");
30
    }
31
32
    public function postSaveConfig() {
33
34
        foreach(request()->except("_token") as $key=>$val) {
35
            putSetting( $key,  $val);
36
        }
37
38
        return cb()->redirectBack("Theme config has been saved!","success");
39
    }
40
}