CareerController   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 102
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 102
rs 10
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A store() 0 5 1
A edit() 0 3 1
A index() 0 3 1
A destroy() 0 5 1
A applications() 0 3 1
A __construct() 0 4 1
A application() 0 3 1
A update() 0 5 1
A show() 0 3 1
1
<?php
2
3
namespace Adminetic\Website\Http\Controllers\Admin;
4
5
use Adminetic\Website\Contracts\CareerRepositoryInterface;
6
use Adminetic\Website\Http\Requests\CareerRequest;
7
use Adminetic\Website\Models\Admin\Application;
8
use Adminetic\Website\Models\Admin\Career;
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 CareerController extends Controller
12
{
13
    protected $careerRepositoryInterface;
14
15
    public function __construct(CareerRepositoryInterface $careerRepositoryInterface)
16
    {
17
        $this->careerRepositoryInterface = $careerRepositoryInterface;
18
        $this->authorizeResource(Career::class, 'career');
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.career.index', $this->careerRepositoryInterface->indexCareer());
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...terface->indexCareer()) 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.career.create');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::admin.career.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\CareerRequest  $request
45
     * @return \Illuminate\Http\Response
46
     */
47
    public function store(CareerRequest $request)
48
    {
49
        $this->careerRepositoryInterface->storeCareer($request);
50
51
        return redirect(adminRedirectRoute('career'))->withSuccess('Career 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('career'))->withSuccess('Career 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\Career  $career
58
     * @return \Illuminate\Http\Response
59
     */
60
    public function show(Career $career)
61
    {
62
        return view('website::admin.career.show', $this->careerRepositoryInterface->showCareer($career));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...e->showCareer($career)) 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\Career  $career
69
     * @return \Illuminate\Http\Response
70
     */
71
    public function edit(Career $career)
72
    {
73
        return view('website::admin.career.edit', $this->careerRepositoryInterface->editCareer($career));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...e->editCareer($career)) 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\CareerRequest  $request
80
     * @param  \Adminetic\Website\Models\Admin\Career  $career
81
     * @return \Illuminate\Http\Response
82
     */
83
    public function update(CareerRequest $request, Career $career)
84
    {
85
        $this->careerRepositoryInterface->updateCareer($request, $career);
86
87
        return redirect(adminRedirectRoute('career'))->withInfo('Career Updated 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

87
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('career'))->withInfo('Career Updated Successfully.');
Loading history...
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...
88
    }
89
90
    /**
91
     * Remove the specified resource from storage.
92
     *
93
     * @param  \Adminetic\Website\Models\Admin\Career  $career
94
     * @return \Illuminate\Http\Response
95
     */
96
    public function destroy(Career $career)
97
    {
98
        $this->careerRepositoryInterface->destroyCareer($career);
99
100
        return redirect(adminRedirectRoute('career'))->withFail('Career 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

100
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('career'))->withFail('Career Deleted Successfully.');
Loading history...
101
    }
102
103
    // Career Applications
104
    public function applications(Career $career)
105
    {
106
        return view('website::admin.career.applications', compact('career'));
107
    }
108
109
    // Career Application Show
110
    public function application(Application $application)
111
    {
112
        return view('website::admin.application.show', compact('application'));
113
    }
114
}
115