Passed
Push — main ( 81a08a...d746a9 )
by PRATIK
13:24
created

FeatureController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Adminetic\Website\Http\Controllers;
4
5
use App\Http\Controllers\Controller;
6
use Adminetic\Website\Models\Admin\Feature;
7
use Adminetic\Website\Http\Requests\FeatureRequest;
8
use Adminetic\Website\Contracts\FeatureRepositoryInterface;
9
10
class FeatureController extends Controller
11
{
12
    protected $featureRepositoryInterface;
13
14
    public function __construct(FeatureRepositoryInterface $featureRepositoryInterface)
15
    {
16
        $this->featureRepositoryInterface = $featureRepositoryInterface;
17
        $this->authorizeResource(Feature::class, 'feature');
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.feature.index', $this->featureRepositoryInterface->indexFeature());
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...erface->indexFeature()) 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.feature.create');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::admin.feature.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  \Adminetic\Website\Http\Requests\FeatureRequest  $request
45
     * @return \Illuminate\Http\Response
46
     */
47
    public function store(FeatureRequest $request)
48
    {
49
        $this->featureRepositoryInterface->storeFeature($request);
50
        return redirect(adminRedirectRoute('feature'))->withSuccess('Feature 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('feature'))->withSuccess('Feature 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  \Adminetic\Website\Models\Admin\Feature  $feature
57
     * @return \Illuminate\Http\Response
58
     */
59
    public function show(Feature $feature)
60
    {
61
        return view('website::admin.feature.show', $this->featureRepositoryInterface->showFeature($feature));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...>showFeature($feature)) 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  \Adminetic\Website\Models\Admin\Feature  $feature
68
     * @return \Illuminate\Http\Response
69
     */
70
    public function edit(Feature $feature)
71
    {
72
        return view('website::admin.feature.edit', $this->featureRepositoryInterface->editFeature($feature));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...>editFeature($feature)) 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  \Adminetic\Website\Http\Requests\FeatureRequest  $request
79
     * @param  \Adminetic\Website\Models\Admin\Feature  $feature
80
     * @return \Illuminate\Http\Response
81
     */
82
    public function update(FeatureRequest $request, Feature $feature)
83
    {
84
        $this->featureRepositoryInterface->updateFeature($request, $feature);
85
        return redirect(adminRedirectRoute('feature'))->withInfo('Feature 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('feature'))->withInfo('Feature Updated Successfully.');
Loading history...
86
    }
87
88
    /**
89
     * Remove the specified resource from storage.
90
     *
91
     * @param  \Adminetic\Website\Models\Admin\Feature  $feature
92
     * @return \Illuminate\Http\Response
93
     */
94
    public function destroy(Feature $feature)
95
    {
96
        $this->featureRepositoryInterface->destroyFeature($feature);
97
        return redirect(adminRedirectRoute('feature'))->withFail('Feature 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('feature'))->withFail('Feature 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