SettingController   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 100
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 100
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 3 1
A store() 0 5 1
A create() 0 3 1
A update() 0 5 1
A setting_store() 0 5 1
A show() 0 3 1
A __construct() 0 4 1
A edit() 0 3 1
A destroy() 0 5 1
1
<?php
2
3
namespace Pratiksh\Adminetic\Http\Controllers\Admin;
4
5
use App\Http\Controllers\Controller;
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Controller 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...
6
use Illuminate\Http\Request;
7
use Pratiksh\Adminetic\Contracts\SettingRepositoryInterface;
8
use Pratiksh\Adminetic\Http\Requests\SettingRequest;
9
use Pratiksh\Adminetic\Models\Admin\Setting;
10
11
class SettingController extends Controller
12
{
13
    protected $settingRepositoryInterface;
14
15
    public function __construct(SettingRepositoryInterface $settingRepositoryInterface)
16
    {
17
        $this->settingRepositoryInterface = $settingRepositoryInterface;
18
        $this->authorizeResource(Setting::class, 'setting');
19
    }
20
21
    /**
22
     * Display a listing of the resource.
23
     *
24
     * @return \Illuminate\Http\Response
25
     */
26
    public function index()
27
    {
28
        return view('adminetic::admin.setting.index', $this->settingRepositoryInterface->indexSetting());
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('adminetic::...erface->indexSetting()) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
29
    }
30
31
    /**
32
     * Show the form for creating a new resource.
33
     *
34
     * @return \Illuminate\Http\Response
35
     */
36
    public function create()
37
    {
38
        return view('adminetic::admin.setting.create', $this->settingRepositoryInterface->createSetting());
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('adminetic::...rface->createSetting()) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
39
    }
40
41
    /**
42
     * Store a newly created resource in storage.
43
     *
44
     * @param  \Pratiksh\Adminetic\Http\Requests\SettingRequest  $request
45
     * @return \Illuminate\Http\Response
46
     */
47
    public function store(SettingRequest $request)
48
    {
49
        $this->settingRepositoryInterface->storeSetting($request);
50
51
        return redirect(adminRedirectRoute('setting'))->withSuccess('Setting Created Successfully.');
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect(adminRed...Created Successfully.') also could return the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
52
    }
53
54
    /**
55
     * Display the specified resource.
56
     *
57
     * @param  \Pratiksh\Adminetic\Models\Admin\Setting  $setting
58
     * @return \Illuminate\Http\Response
59
     */
60
    public function show(Setting $setting)
61
    {
62
        return view('adminetic::admin.setting.show', $this->settingRepositoryInterface->showSetting($setting));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('adminetic::...>showSetting($setting)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
63
    }
64
65
    /**
66
     * Show the form for editing the specified resource.
67
     *
68
     * @param  \Pratiksh\Adminetic\Models\Admin\Setting  $setting
69
     * @return \Illuminate\Http\Response
70
     */
71
    public function edit(Setting $setting)
72
    {
73
        return view('adminetic::admin.setting.edit', $this->settingRepositoryInterface->editSetting($setting));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('adminetic::...>editSetting($setting)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
74
    }
75
76
    /**
77
     * Update the specified resource in storage.
78
     *
79
     * @param  \Pratiksh\Adminetic\Http\Requests\SettingRequest  $request
80
     * @param  \Pratiksh\Adminetic\Models\Admin\Setting  $setting
81
     * @return \Illuminate\Http\Response
82
     */
83
    public function update(SettingRequest $request, Setting $setting)
84
    {
85
        $this->settingRepositoryInterface->updateSetting($request, $setting);
86
87
        return redirect(adminRedirectRoute('setting'))->withInfo('Setting Updated Successfully.');
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect(adminRed...Updated Successfully.') also could return the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
88
    }
89
90
    /**
91
     * Remove the specified resource from storage.
92
     *
93
     * @param  \Pratiksh\Adminetic\Models\Admin\Setting  $setting
94
     * @return \Illuminate\Http\Response
95
     */
96
    public function destroy(Setting $setting)
97
    {
98
        $this->settingRepositoryInterface->destroySetting($setting);
99
100
        return redirect(adminRedirectRoute('setting'))->withFail('Setting Deleted Successfully.');
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect(adminRed...Deleted Successfully.') also could return the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
101
    }
102
103
    /**
104
     * Setting Store.
105
     */
106
    public function setting_store(Request $request)
107
    {
108
        $this->settingRepositoryInterface->setting_store($request);
109
110
        return redirect(adminRedirectRoute('setting'))->withInfo('Settings Saved !.');
111
    }
112
}
113