ProcessController::update()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
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 2
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Adminetic\Website\Http\Controllers\Admin;
4
5
use Adminetic\Website\Contracts\ProcessRepositoryInterface;
6
use Adminetic\Website\Http\Requests\ProcessRequest;
7
use Adminetic\Website\Models\Admin\Process;
8
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...
9
10
class ProcessController extends Controller
11
{
12
    protected $processRepositoryInterface;
13
14
    public function __construct(ProcessRepositoryInterface $processRepositoryInterface)
15
    {
16
        $this->processRepositoryInterface = $processRepositoryInterface;
17
        $this->authorizeResource(Process::class, 'process');
18
    }
19
20
    /**
21
     * Display a listing of the resource.
22
     *
23
     * @return \Illuminate\Http\Response
24
     */
25
    public function index()
26
    {
27
        return view('website::admin.process.index', $this->processRepositoryInterface->indexProcess());
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...erface->indexProcess()) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
28
    }
29
30
    /**
31
     * Show the form for creating a new resource.
32
     *
33
     * @return \Illuminate\Http\Response
34
     */
35
    public function create()
36
    {
37
        return view('website::admin.process.create');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::admin.process.create') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
38
    }
39
40
    /**
41
     * Store a newly created resource in storage.
42
     *
43
     * @param  \Adminetic\Website\Http\Requests\ProcessRequest  $request
44
     * @return \Illuminate\Http\Response
45
     */
46
    public function store(ProcessRequest $request)
47
    {
48
        $this->processRepositoryInterface->storeProcess($request);
49
50
        return redirect(adminRedirectRoute('process'))->withSuccess('Process 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\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

50
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('process'))->withSuccess('Process Created Successfully.');
Loading history...
51
    }
52
53
    /**
54
     * Display the specified resource.
55
     *
56
     * @param  \Adminetic\Website\Models\Admin\Process  $process
57
     * @return \Illuminate\Http\Response
58
     */
59
    public function show(Process $process)
60
    {
61
        return view('website::admin.process.show', $this->processRepositoryInterface->showProcess($process));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...>showProcess($process)) 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\Process  $process
68
     * @return \Illuminate\Http\Response
69
     */
70
    public function edit(Process $process)
71
    {
72
        return view('website::admin.process.edit', $this->processRepositoryInterface->editProcess($process));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...>editProcess($process)) 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\ProcessRequest  $request
79
     * @param  \Adminetic\Website\Models\Admin\Process  $process
80
     * @return \Illuminate\Http\Response
81
     */
82
    public function update(ProcessRequest $request, Process $process)
83
    {
84
        $this->processRepositoryInterface->updateProcess($request, $process);
85
86
        return redirect(adminRedirectRoute('process'))->withInfo('Process 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('process'))->withInfo('Process Updated Successfully.');
Loading history...
87
    }
88
89
    /**
90
     * Remove the specified resource from storage.
91
     *
92
     * @param  \Adminetic\Website\Models\Admin\Process  $process
93
     * @return \Illuminate\Http\Response
94
     */
95
    public function destroy(Process $process)
96
    {
97
        $this->processRepositoryInterface->destroyProcess($process);
98
99
        return redirect(adminRedirectRoute('process'))->withFail('Process 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

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