samtny /
league-frontend
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace App\Http\Controllers; |
||||
| 4 | |||||
| 5 | use App\Association; |
||||
| 6 | use App\Team; |
||||
| 7 | use Bouncer; |
||||
|
0 ignored issues
–
show
|
|||||
| 8 | use Illuminate\Http\Request; |
||||
| 9 | |||||
| 10 | class TeamsController extends Controller |
||||
| 11 | { |
||||
| 12 | |||||
| 13 | public function create(Association $association) { |
||||
| 14 | return view('team.create', [ |
||||
| 15 | 'association' => $association, |
||||
| 16 | ]); |
||||
| 17 | } |
||||
| 18 | |||||
| 19 | public function store(Association $association, Request $request) { |
||||
| 20 | if (Bouncer::can('create', Team::class)) { |
||||
| 21 | $validatedData = $request->validate([ |
||||
|
0 ignored issues
–
show
|
|||||
| 22 | 'name' => 'required|max:255', |
||||
| 23 | ]); |
||||
| 24 | |||||
| 25 | $team = new team; |
||||
| 26 | |||||
| 27 | $team->name = $request->name; |
||||
| 28 | $team->association_id = $association->id; |
||||
| 29 | $team->venue_id = !empty($request->venue_id) ? $request->venue_id : null; |
||||
| 30 | |||||
| 31 | $team->save(); |
||||
| 32 | |||||
| 33 | return redirect()->route('association.teams', ['association' => $association]); |
||||
| 34 | } |
||||
| 35 | else { |
||||
| 36 | return view('denied'); |
||||
| 37 | } |
||||
| 38 | } |
||||
| 39 | |||||
| 40 | public function update(Association $association, Team $team, Request $request) { |
||||
|
0 ignored issues
–
show
The parameter
$association 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
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...
|
|||||
| 41 | if (Bouncer::can('update', Team::class)) { |
||||
| 42 | $validatedData = $request->validate([ |
||||
|
0 ignored issues
–
show
|
|||||
| 43 | 'name' => 'required|max:255', |
||||
| 44 | ]); |
||||
| 45 | |||||
| 46 | $team = Team::where(['id' => $team->id])->first(); |
||||
| 47 | |||||
| 48 | $team->name = $request->name; |
||||
| 49 | $team->venue_id = !empty($request->venue_id) ? $request->venue_id : null; |
||||
| 50 | |||||
| 51 | $team->save(); |
||||
| 52 | |||||
| 53 | return redirect()->route('association.teams', ['association' => $team->association]); |
||||
| 54 | } |
||||
| 55 | else { |
||||
| 56 | return view('denied'); |
||||
| 57 | } |
||||
| 58 | } |
||||
| 59 | |||||
| 60 | public function edit(Association $association, Team $team) { |
||||
| 61 | return view('team.edit', ['team' => $team]); |
||||
| 62 | } |
||||
| 63 | |||||
| 64 | public function deleteConfirm(Association $association, Team $team) { |
||||
|
0 ignored issues
–
show
The parameter
$association 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
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...
|
|||||
| 65 | if (Bouncer::can('delete', $team)) { |
||||
| 66 | return view('team.delete', ['team' => $team]); |
||||
| 67 | } |
||||
| 68 | else { |
||||
| 69 | return view('denied'); |
||||
| 70 | } |
||||
| 71 | } |
||||
| 72 | |||||
| 73 | public function delete(Association $association, Team $team) { |
||||
| 74 | if (Bouncer::can('delete', $team)) { |
||||
| 75 | $team->delete(); |
||||
| 76 | |||||
| 77 | return redirect()->route('association.teams', ['association' => $association])->with('success', 'Team deleted successfully.'); |
||||
| 78 | } |
||||
| 79 | else { |
||||
| 80 | return view('denied'); |
||||
| 81 | } |
||||
| 82 | } |
||||
| 83 | |||||
| 84 | } |
||||
| 85 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths