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.
Passed
Push — master ( f70a3e...865955 )
by Piyapan
03:14
created

TermController::edit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Raystech\StarterKit\Http\Controllers;
4
5
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
6
use Illuminate\Foundation\Bus\DispatchesJobs;
7
use Illuminate\Foundation\Validation\ValidatesRequests;
8
use Illuminate\Routing\Controller as BaseController;
9
use Illuminate\Http\Request;
10
11
use Raystech\StarterKit\Models\Term;
12
use Raystech\StarterKit\Models\TermTaxonomy;
13
14
class TermController extends BaseController
15
{
16
  /**
17
   * Display a listing of the resource.
18
   *
19
   * @return \Illuminate\Http\Response
20
   */
21
22
23
  public function index(Request $request)
24
  {
25
    $parent = $request->get('term_id') ?? 0;
26
    if($request->has('taxonomy')) {
27
      $taxonomy = $request->taxonomy;
28
    } else {
29
      $taxonomy = 'rt_data_structure';
30
    }
31
    $term_taxonomy = TermTaxonomy::where('taxonomy', $taxonomy)->where('parent', $parent)->get();
32
    $term = Term::find($parent);
33
      // $terms = Term::where('')->get();
34
    return view('rt-starter-kit::terms.index', compact([
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('rt-starter-...rm_taxonomy', 'term'))) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
35
      'taxonomy', 'term_taxonomy', 'term'
36
    ]));
37
  }
38
39
  /**
40
   * Show the form for creating a new resource.
41
   *
42
   * @return \Illuminate\Http\Response
43
   */
44
  public function create()
45
  {
46
      //
47
  }
48
49
  /**
50
   * Store a newly created resource in storage.
51
   *
52
   * @param  \Illuminate\Http\Request  $request
53
   * @return \Illuminate\Http\Response
54
   */
55
  public function store(Request $request)
56
  {
57
    // dd($request->all());
58
    $request->validate([
59
      'name'     => 'required',
60
      'taxonomy' => 'required',
61
    ]);
62
63
    $term = Term::create([
64
      'name' => $request->get('name')
65
    ]);
66
67
    $term_taxonomy = TermTaxonomy::create([
0 ignored issues
show
Unused Code introduced by
The assignment to $term_taxonomy is dead and can be removed.
Loading history...
68
      'term_id'     => $term->id,
69
      'taxonomy'    => $request->taxonomy,
70
      'description' => $request->description,
71
      'parent'      => $request->get('term_id') ?? 0,
72
      'count'       => 0
73
    ]);
74
    return redirect()->back();
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect()->back() returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
75
76
  }
77
78
  /**
79
   * Display the specified resource.
80
   *
81
   * @param  int  $id
82
   * @return \Illuminate\Http\Response
83
   */
84
  public function show($id)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

84
  public function show(/** @scrutinizer ignore-unused */ $id)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
85
  {
86
      //
87
  }
88
89
  /**
90
   * Show the form for editing the specified resource.
91
   *
92
   * @param  int  $id
93
   * @return \Illuminate\Http\Response
94
   */
95
  public function edit($id)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

95
  public function edit(/** @scrutinizer ignore-unused */ $id)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
96
  {
97
      //
98
  }
99
100
  /**
101
   * Update the specified resource in storage.
102
   *
103
   * @param  \Illuminate\Http\Request  $request
104
   * @param  int  $id
105
   * @return \Illuminate\Http\Response
106
   */
107
  public function update(Request $request, $id)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

107
  public function update(Request $request, /** @scrutinizer ignore-unused */ $id)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

107
  public function update(/** @scrutinizer ignore-unused */ Request $request, $id)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
108
  {
109
      //
110
  }
111
112
  /**
113
   * Remove the specified resource from storage.
114
   *
115
   * @param  int  $id
116
   * @return \Illuminate\Http\Response
117
   */
118
  public function destroy($id)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

118
  public function destroy(/** @scrutinizer ignore-unused */ $id)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
119
  {
120
      //
121
  }
122
}
123