GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SupplierController::destroy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 2
Metric Value
c 3
b 0
f 2
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Events\SupplierWasCreated;
6
use App\Events\SupplierWasDeleted;
7
use App\Supplier;
8
use Illuminate\Http\Request;
9
10
class SupplierController extends Controller
11
{
12
    /**
13
     * SupplierController constructor.
14
     */
15 7
    public function __construct()
16
    {
17 7
        $this->middleware('auth');
18 7
    }
19
20
    /**
21
     * Display a listing of the resource.
22
     *
23
     * @return \Illuminate\Http\Response
24
     */
25 1
    public function index()
26
    {
27 1
        return view('suppliers.index');
28
    }
29
30
    /**
31
     * Store a newly created resource in storage.
32
     *
33
     * @param  \Illuminate\Http\Request $request
34
     */
35 2
    public function store(Request $request)
36
    {
37 2
        $this->validate($request, [
38 2
            'name'     => 'required|string|max:255',
39
            'location' => 'required|string|max:255',
40
        ]);
41
42 1
        $supplier = Supplier::create($request->only(['name', 'location']));
43 1
        event(new SupplierWasCreated($supplier));
44 1
    }
45
46
    /**
47
     * Remove the specified resource from storage.
48
     *
49
     * @param  int $id
50
     */
51 1
    public function destroy($id)
52
    {
53 1
        $supplier = Supplier::findOrFail($id);
54 1
        event(new SupplierWasDeleted($supplier));
55 1
        $supplier->delete();
56 1
    }
57
}
58