Completed
Push — main ( 3e1c9f...1d9eb2 )
by PRATIK
19s queued 16s
created

SliderController::edit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Adminetic\Website\Http\Controllers\Admin;
4
5
6
use Adminetic\Website\Contracts\SliderRepositoryInterface;
7
use Adminetic\Website\Http\Requests\SliderRequest;
0 ignored issues
show
Bug introduced by
The type Adminetic\Website\Http\Requests\SliderRequest 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 Adminetic\Website\Models\Admin\Slider;
0 ignored issues
show
Bug introduced by
The type Adminetic\Website\Models\Admin\Slider 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...
9
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...
10
11
class SliderController extends Controller
12
{
13
    protected $sliderRepositoryInterface;
14
15
    public function __construct(SliderRepositoryInterface $sliderRepositoryInterface)
16
    {
17
        $this->sliderRepositoryInterface = $sliderRepositoryInterface;
18
        $this->authorizeResource(Slider::class, 'slider');
19
    }
20
21
22
    /**
23
     * Display a listing of the resource.
24
     *
25
     * @return \Illuminate\Http\Response
26
     */
27
    public function index()
28
    {
29
        return view('website::admin.slider.index', $this->sliderRepositoryInterface->indexSlider());
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...terface->indexSlider()) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
30
    }
31
32
    /**
33
     * Show the form for creating a new resource.
34
     *
35
     * @return \Illuminate\Http\Response
36
     */
37
    public function create()
38
    {
39
        return view('website::admin.slider.create');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::admin.slider.create') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
40
    }
41
42
    /**
43
     * Store a newly created resource in storage.
44
     *
45
     * @param  Adminetic\Website\Http\Requests\SliderRequest  $request
0 ignored issues
show
Bug introduced by
The type Adminetic\Website\Http\C...\Requests\SliderRequest 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...
46
     * @return \Illuminate\Http\Response
47
     */
48
    public function store(SliderRequest $request)
49
    {
50
        $this->sliderRepositoryInterface->storeSlider($request);
51
        return redirect(adminRedirectRoute('slider'))->withSuccess('Slider Created Successfully.');
0 ignored issues
show
Bug introduced by
The function adminRedirectRoute was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

51
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('slider'))->withSuccess('Slider Created Successfully.');
Loading history...
Bug Best Practice introduced by
The expression return redirect(adminRed...Created Successfully.') also could return the type Illuminate\Http\Redirect...nate\Routing\Redirector which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
52
    }
53
54
    /**
55
     * Display the specified resource.
56
     *
57
     * @param  Adminetic\Website\Models\Admin\Slider  $slider
0 ignored issues
show
Bug introduced by
The type Adminetic\Website\Http\C...ite\Models\Admin\Slider 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...
58
     * @return \Illuminate\Http\Response
59
     */
60
    public function show(Slider $slider)
61
    {
62
        return view('website::admin.slider.show', $this->sliderRepositoryInterface->showSlider($slider));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...e->showSlider($slider)) 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  Adminetic\Website\Models\Admin\Slider  $slider
69
     * @return \Illuminate\Http\Response
70
     */
71
    public function edit(Slider $slider)
72
    {
73
        return view('website::admin.slider.edit', $this->sliderRepositoryInterface->editSlider($slider));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...e->editSlider($slider)) 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  Adminetic\Website\Http\Requests\SliderRequest  $request
80
     * @param  Adminetic\Website\Models\Admin\Slider  $slider
81
     * @return \Illuminate\Http\Response
82
     */
83
    public function update(SliderRequest $request, Slider $slider)
84
    {
85
        $this->sliderRepositoryInterface->updateSlider($request, $slider);
86
        return redirect(adminRedirectRoute('slider'))->withInfo('Slider 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\Redirect...nate\Routing\Redirector which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Bug introduced by
The function adminRedirectRoute was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

86
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('slider'))->withInfo('Slider Updated Successfully.');
Loading history...
87
    }
88
89
    /**
90
     * Remove the specified resource from storage.
91
     *
92
     * @param  Adminetic\Website\Models\Admin\Slider  $slider
93
     * @return \Illuminate\Http\Response
94
     */
95
    public function destroy(Slider $slider)
96
    {
97
        $this->sliderRepositoryInterface->destroySlider($slider);
98
        return redirect(adminRedirectRoute('slider'))->withFail('Slider 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\Redirect...nate\Routing\Redirector which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Bug introduced by
The function adminRedirectRoute was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

98
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('slider'))->withFail('Slider Deleted Successfully.');
Loading history...
99
    }
100
}
101