Passed
Push — bugfix/job_translation_fields ( dcec43...2ad85b )
by Tristan
14:10
created

DegreeController::destroy()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace App\Http\Controllers;
4
5
use App\Models\Degree;
6
use Illuminate\Http\Request;
7
8
class DegreeController extends Controller
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class DegreeController
Loading history...
9
{
10
    /**
11
     * Remove the specified resource from storage.
12
     *
13
     * @param  \Illuminate\Http\Request  $request
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
14
     * @param  \App\Models\Degree  $degree
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 7 spaces after parameter type; 2 found
Loading history...
15
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
16
     */
17
    public function destroy(Request $request, Degree $degree)
18
    {
19
        $this->authorize('delete', $degree);
20
        $degree->delete();
21
22
        if ($request->ajax()) {
23
            return [
1 ignored issue
show
Bug Best Practice introduced by
The expression return array('message' => 'Degree deleted') returns the type array<string,string> which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
24
                'message' => 'Degree deleted',
25
            ];
26
        }
27
28
        return back();
1 ignored issue
show
Bug Best Practice introduced by
The expression return back() returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
29
    }
30
}
31