Passed
Push — dependabot/npm_and_yarn/string... ( b56eb5...bc569b )
by
unknown
45:46 queued 33s
created

SettingsController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 20
ccs 5
cts 9
cp 0.5556
rs 10
c 0
b 0
f 0
wmc 2
1
<?php
2
3
namespace Thinktomorrow\Chief\App\Http\Controllers\Back\System;
4
5
use Illuminate\Http\Request;
6
use Thinktomorrow\Chief\Settings\Setting;
7
use Thinktomorrow\Chief\App\Http\Controllers\Controller;
8
use Thinktomorrow\Chief\Settings\Application\UpdateSetting;
9
10
class SettingsController extends Controller
11
{
12
    public function edit()
13
    {
14
        $this->authorize('update-setting');
15
16
        $settings = Setting::all();
17
18
        return view('chief::back.system.settings', compact('settings'));
19
    }
20
21
    public function update(Request $request)
22
    {
23
        $this->authorize('update-setting');
24
25
        app(UpdateSetting::class)->handle(
26
            $request->get('settings')
27
        );
28
29
        return redirect()->route('chief.back.settings.edit')->with('messages.success', 'Settings zijn aangepast!');
30
    }
31
}
32