Passed
Push — ft/appmove ( db87fd...97613e )
by Philippe
45:05 queued 26:47
created

SettingsController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 28
c 0
b 0
f 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A edit() 0 6 1
A __construct() 0 3 1
A update() 0 9 1
1
<?php
2
3
namespace Thinktomorrow\Chief\App\Http\Controllers\Back\System;
4
5
use Illuminate\Http\Request;
6
use Thinktomorrow\Chief\App\Http\Controllers\Controller;
7
use Thinktomorrow\Chief\Settings\Application\UpdateSetting;
0 ignored issues
show
Bug introduced by
The type Thinktomorrow\Chief\Sett...plication\UpdateSetting was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Thinktomorrow\Chief\Settings\SettingFieldsManager;
9
10
class SettingsController extends Controller
11
{
12
    /** @var SettingFieldsManager */
13
    private $settingFieldsManager;
14
15
    public function __construct(SettingFieldsManager $settingFieldsManager)
16
    {
17
        $this->settingFieldsManager = $settingFieldsManager;
18
    }
19
20
    public function edit()
21
    {
22
        $this->authorize('update-setting');
23
24
        return view('chief::back.system.settings', [
25
            'manager' => $this->settingFieldsManager,
26
        ]);
27
    }
28
29
    public function update(Request $request)
30
    {
31
        $this->authorize('update-setting');
32
33
        $this->settingFieldsManager->fields()->validate($request->all());
34
35
        $this->settingFieldsManager->saveFields($request);
36
37
        return redirect()->route('chief.back.settings.edit')->with('messages.success', 'De settings zijn aangepast!');
38
    }
39
}
40