This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||||
2 | |||||
3 | namespace App\Admin\Controllers; |
||||
4 | |||||
5 | use App\Models\Eloquent\Dojo\Dojo; |
||||
6 | use App\Http\Controllers\Controller; |
||||
7 | use App\Models\Eloquent\Dojo\DojoPhase; |
||||
8 | use App\Models\Eloquent\Problem; |
||||
9 | use Encore\Admin\Controllers\HasResourceActions; |
||||
10 | use Encore\Admin\Form; |
||||
11 | use Encore\Admin\Grid; |
||||
12 | use Encore\Admin\Layout\Content; |
||||
13 | use Encore\Admin\Show; |
||||
14 | |||||
15 | class DojoController extends Controller |
||||
16 | { |
||||
17 | use HasResourceActions; |
||||
18 | |||||
19 | /** |
||||
20 | * Index interface. |
||||
21 | * |
||||
22 | * @param Content $content |
||||
23 | * @return Content |
||||
24 | */ |
||||
25 | public function index(Content $content) |
||||
26 | { |
||||
27 | return $content |
||||
28 | ->header(__('admin.dojos.index.header')) |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
29 | ->description(__('admin.dojos.index.description')) |
||||
0 ignored issues
–
show
It seems like
__('admin.dojos.index.description') can also be of type array and array ; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
30 | ->body($this->grid()->render()); |
||||
31 | } |
||||
32 | |||||
33 | /** |
||||
34 | * Show interface. |
||||
35 | * |
||||
36 | * @param mixed $id |
||||
37 | * @param Content $content |
||||
38 | * @return Content |
||||
39 | */ |
||||
40 | public function show($id, Content $content) |
||||
41 | { |
||||
42 | return $content |
||||
43 | ->header(__('admin.dojos.show.header')) |
||||
0 ignored issues
–
show
It seems like
__('admin.dojos.show.header') can also be of type array and array ; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
44 | ->description(__('admin.dojos.show.description')) |
||||
0 ignored issues
–
show
It seems like
__('admin.dojos.show.description') can also be of type array and array ; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
45 | ->body($this->detail($id)); |
||||
46 | } |
||||
47 | |||||
48 | /** |
||||
49 | * Edit interface. |
||||
50 | * |
||||
51 | * @param mixed $id |
||||
52 | * @param Content $content |
||||
53 | * @return Content |
||||
54 | */ |
||||
55 | public function edit($id, Content $content) |
||||
56 | { |
||||
57 | return $content |
||||
58 | ->header(__('admin.dojos.edit.header')) |
||||
0 ignored issues
–
show
It seems like
__('admin.dojos.edit.header') can also be of type array and array ; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
59 | ->description(__('admin.dojos.edit.description')) |
||||
0 ignored issues
–
show
It seems like
__('admin.dojos.edit.description') can also be of type array and array ; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
60 | ->body($this->form()->edit($id)); |
||||
61 | } |
||||
62 | |||||
63 | /** |
||||
64 | * Create interface. |
||||
65 | * |
||||
66 | * @param Content $content |
||||
67 | * @return Content |
||||
68 | */ |
||||
69 | public function create(Content $content) |
||||
70 | { |
||||
71 | return $content |
||||
72 | ->header(__('admin.dojos.create.header')) |
||||
0 ignored issues
–
show
It seems like
__('admin.dojos.create.header') can also be of type array and array ; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
73 | ->description(__('admin.dojos.create.description')) |
||||
0 ignored issues
–
show
It seems like
__('admin.dojos.create.description') can also be of type array and array ; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
74 | ->body($this->form()); |
||||
75 | } |
||||
76 | |||||
77 | /** |
||||
78 | * Make a grid builder. |
||||
79 | * |
||||
80 | * @return Grid |
||||
81 | */ |
||||
82 | protected function grid() |
||||
83 | { |
||||
84 | $grid=new Grid(new Dojo); |
||||
85 | $grid->column('id', "ID")->sortable(); |
||||
86 | $grid->column("name", __('admin.dojos.name'))->editable(); |
||||
0 ignored issues
–
show
It seems like
__('admin.dojos.name') can also be of type array and array ; however, parameter $label of Encore\Admin\Grid::column() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
87 | $grid->column("dojo_phase", __('admin.dojos.phase'))->display(function() { |
||||
88 | return $this->phase->name; |
||||
0 ignored issues
–
show
|
|||||
89 | }); |
||||
90 | $grid->column("totproblem", __('admin.dojos.totproblem'))->display(function() { |
||||
91 | return $this->tot_problem; |
||||
0 ignored issues
–
show
|
|||||
92 | }); |
||||
93 | $grid->column("passline", __('admin.dojos.passline')); |
||||
94 | $grid->column("precondition", __('admin.dojos.precondition'))->display(function($precondition) { |
||||
95 | $output=''; |
||||
96 | foreach ($precondition as $p) { |
||||
97 | $output.='<span class="label label-primary">'.Dojo::find($p)->name.'</span> '; |
||||
0 ignored issues
–
show
|
|||||
98 | } |
||||
99 | return $output; |
||||
100 | }); |
||||
101 | $grid->column("order", __('admin.dojos.order'))->sortable(); |
||||
102 | $grid->created_at(__('admin.created_at')); |
||||
103 | $grid->updated_at(__('admin.updated_at')); |
||||
104 | |||||
105 | $grid->filter(function(Grid\Filter $filter) { |
||||
106 | $filter->column(6, function($filter) { |
||||
107 | $filter->like('name', __('admin.dojos.name')); |
||||
108 | }); |
||||
109 | $filter->column(6, function($filter) { |
||||
110 | $filter->equal('dojo_phase_id', __('admin.dojos.phase'))->select(DojoPhase::all()->pluck('name', 'id')); |
||||
111 | }); |
||||
112 | }); |
||||
113 | return $grid; |
||||
114 | } |
||||
115 | |||||
116 | /** |
||||
117 | * Make a show builder. |
||||
118 | * |
||||
119 | * @param mixed $id |
||||
120 | * @return Show |
||||
121 | */ |
||||
122 | protected function detail($id) |
||||
123 | { |
||||
124 | $show=new Show(Dojo::findOrFail($id)); |
||||
125 | $show->id('ID'); |
||||
126 | $show->name(__('admin.dojos.name')); |
||||
127 | $show->description(__('admin.dojos.description')); |
||||
128 | $show->dojo_phase_id(__('admin.dojos.phase')); |
||||
129 | $show->passline(__('admin.dojos.passline')); |
||||
130 | $show->order(__('admin.dojos.order')); |
||||
131 | return $show; |
||||
132 | } |
||||
133 | |||||
134 | /** |
||||
135 | * Make a form builder. |
||||
136 | * |
||||
137 | * @return Form |
||||
138 | */ |
||||
139 | protected function form() |
||||
140 | { |
||||
141 | $form=new Form(new Dojo); |
||||
142 | $form->tab('Basic', function(Form $form) { |
||||
143 | $form->display('id', 'ID'); |
||||
144 | $form->text('name', __('admin.dojos.name'))->rules('required'); |
||||
145 | $form->textarea('description', __('admin.dojos.description'))->rules('required'); |
||||
146 | $form->select('dojo_phase_id', __('admin.dojos.phase'))->options(DojoPhase::all()->pluck('name', 'id'))->rules('required'); |
||||
147 | $form->number('passline', __('admin.dojos.passline'))->default(0)->rules('required'); |
||||
148 | $form->number('order', __('admin.dojos.order'))->default(0)->rules('required'); |
||||
149 | $form->multipleSelect('precondition', __('admin.dojos.precondition'))->options(Dojo::all()->pluck('name', 'id')); |
||||
150 | $form->hasMany('problems', __('admin.dojos.problems'), function(Form\NestedForm $form) { |
||||
151 | $form->select('problem_id', __('admin.dojos.problem'))->options(function($pid) { |
||||
152 | $problem=Problem::find($pid); |
||||
153 | if ($problem) { |
||||
154 | return [$problem->pid => $problem->readable_name]; |
||||
155 | } |
||||
156 | })->config('minimumInputLength', 4)->ajax(route('admin.api.problems'))->required(); |
||||
157 | $form->number('order', __('admin.dojos.problemorder'))->default(0)->required(); |
||||
158 | }); |
||||
159 | }); |
||||
160 | return $form; |
||||
161 | } |
||||
162 | } |
||||
163 |