Passed
Push — main ( bb1631...b48e8d )
by PRATIK
07:52 queued 04:02
created

AboutController::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
use Adminetic\Website\Models\Admin\About;
6
use Adminetic\Website\Http\Requests\AboutRequest;
7
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...
8
use Adminetic\Website\Contracts\AboutRepositoryInterface;
9
10
class AboutController extends Controller
11
{
12
    protected $aboutRepositoryInterface;
13
14
    public function __construct(AboutRepositoryInterface $aboutRepositoryInterface)
15
    {
16
        $this->aboutRepositoryInterface = $aboutRepositoryInterface;
17
        $this->authorizeResource(About::class, 'about');
18
    }
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('website::admin.about.index', $this->aboutRepositoryInterface->indexAbout());
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...nterface->indexAbout()) 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('website::admin.about.create');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::admin.about.create') 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  \App\Http\Requests\AboutRequest  $request
0 ignored issues
show
Bug introduced by
The type App\Http\Requests\AboutRequest 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...
45
     * @return \Illuminate\Http\Response
46
     */
47
    public function store(AboutRequest $request)
48
    {
49
        $this->aboutRepositoryInterface->storeAbout($request);
50
        return redirect(adminRedirectRoute('about'))->withSuccess('About 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

50
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('about'))->withSuccess('About 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...
51
    }
52
53
    /**
54
     * Display the specified resource.
55
     *
56
     * @param  \App\Models\Admin\About  $about
0 ignored issues
show
Bug introduced by
The type App\Models\Admin\About 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...
57
     * @return \Illuminate\Http\Response
58
     */
59
    public function show(About $about)
60
    {
61
        return view('website::admin.about.show', $this->aboutRepositoryInterface->showAbout($about));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...ace->showAbout($about)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
62
    }
63
64
    /**
65
     * Show the form for editing the specified resource.
66
     *
67
     * @param  \App\Models\Admin\About  $about
68
     * @return \Illuminate\Http\Response
69
     */
70
    public function edit(About $about)
71
    {
72
        return view('website::admin.about.edit', $this->aboutRepositoryInterface->editAbout($about));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...ace->editAbout($about)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
73
    }
74
75
    /**
76
     * Update the specified resource in storage.
77
     *
78
     * @param  \App\Http\Requests\AboutRequest  $request
79
     * @param  \App\Models\Admin\About  $about
80
     * @return \Illuminate\Http\Response
81
     */
82
    public function update(AboutRequest $request, About $about)
83
    {
84
        $this->aboutRepositoryInterface->updateAbout($request, $about);
85
        return redirect(adminRedirectRoute('about'))->withInfo('About 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

85
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('about'))->withInfo('About Updated Successfully.');
Loading history...
86
    }
87
88
    /**
89
     * Remove the specified resource from storage.
90
     *
91
     * @param  \App\Models\Admin\About  $about
92
     * @return \Illuminate\Http\Response
93
     */
94
    public function destroy(About $about)
95
    {
96
        $this->aboutRepositoryInterface->destroyAbout($about);
97
        return redirect(adminRedirectRoute('about'))->withFail('About Deleted 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

97
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('about'))->withFail('About Deleted Successfully.');
Loading history...
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...
98
    }
99
}
100