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\Carousel; |
||||||
6 | use App\Models\JudgerModel; |
||||||
7 | use App\Models\Eloquent\OJ; |
||||||
8 | use Encore\Admin\Controllers\AdminController; |
||||||
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 CarouselController extends AdminController |
||||||
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.carousels.index.header')) |
||||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
29 | ->description(__('admin.carousels.index.description')) |
||||||
0 ignored issues
–
show
It seems like
__('admin.carousels.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
Loading history...
|
|||||||
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.carousels.show.header')) |
||||||
0 ignored issues
–
show
It seems like
__('admin.carousels.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
Loading history...
|
|||||||
44 | ->description(__('admin.carousels.show.description')) |
||||||
0 ignored issues
–
show
It seems like
__('admin.carousels.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
Loading history...
|
|||||||
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.carousels.edit.header')) |
||||||
0 ignored issues
–
show
It seems like
__('admin.carousels.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
Loading history...
|
|||||||
59 | ->description(__('admin.carousels.edit.description')) |
||||||
0 ignored issues
–
show
It seems like
__('admin.carousels.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
Loading history...
|
|||||||
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.carousels.create.header')) |
||||||
0 ignored issues
–
show
It seems like
__('admin.carousels.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
Loading history...
|
|||||||
73 | ->description(__('admin.carousels.create.description')) |
||||||
0 ignored issues
–
show
It seems like
__('admin.carousels.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
Loading history...
|
|||||||
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 Carousel()); |
||||||
85 | |||||||
86 | $grid->model()->orderBy('updated_at', 'desc'); |
||||||
87 | |||||||
88 | $grid->column('caid', 'CAID'); |
||||||
89 | $grid->column('image', __('admin.carousels.image'))->display(function($url) { |
||||||
0 ignored issues
–
show
It seems like
__('admin.carousels.image') 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
Loading history...
|
|||||||
90 | return '<img src="'.$url.'" style="max-width:200px;max-height:200px" class="img img-thumbnail">'; |
||||||
91 | }); |
||||||
92 | $grid->column('url', __('admin.carousels.url'))->editable(); |
||||||
93 | $grid->column('title', __('admin.carousels.title'))->editable(); |
||||||
94 | $grid->column('available', __('admin.carousels.availability'))->switch(); |
||||||
95 | $grid->column('created_at', __('admin.created_at')); |
||||||
96 | $grid->column('updated_at', __('admin.updated_at'))->sortable(); |
||||||
97 | |||||||
98 | return $grid; |
||||||
99 | } |
||||||
100 | |||||||
101 | /** |
||||||
102 | * Make a show builder. |
||||||
103 | * |
||||||
104 | * @param mixed $id |
||||||
105 | * @return Show |
||||||
106 | */ |
||||||
107 | protected function detail($id) |
||||||
108 | { |
||||||
109 | $show=new Show(Carousel::findOrFail($id)); |
||||||
110 | |||||||
111 | $show->field('caid', 'CAID'); |
||||||
112 | $show->field('image', __('admin.carousels.image'))->unescape()->as(function($url) { |
||||||
0 ignored issues
–
show
It seems like
__('admin.carousels.image') can also be of type array and array ; however, parameter $label of Encore\Admin\Show::field() 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
Loading history...
|
|||||||
113 | return '<img src="'.$url.'" style="max-width:200px;max-height:200px" class="img img-thumbnail">'; |
||||||
114 | }); |
||||||
115 | $show->field('url', __('admin.carousels.url'))->link(); |
||||||
116 | $show->field('title', __('admin.carousels.title')); |
||||||
117 | $show->field('available', __('admin.carousels.availability'))->unescape()->as(function($available) { |
||||||
118 | return $available ? '<i class="MDI check-circle wemd-teal-text"></i> '.__('admin.carousels.available') : '<i class="MDI close-circle wemd-pink-text"></i> '.__('admin.carousels.unavailable'); |
||||||
0 ignored issues
–
show
Are you sure
__('admin.carousels.available') of type array|string can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
Are you sure
__('admin.carousels.unavailable') of type array|string can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
119 | }); |
||||||
120 | $show->field('created_at', __('admin.created_at')); |
||||||
121 | $show->field('updated_at', __('admin.updated_at')); |
||||||
122 | |||||||
123 | return $show; |
||||||
124 | } |
||||||
125 | |||||||
126 | /** |
||||||
127 | * Make a form builder. |
||||||
128 | * |
||||||
129 | * @return Form |
||||||
130 | */ |
||||||
131 | protected function form() |
||||||
132 | { |
||||||
133 | $form=new Form(new Carousel()); |
||||||
134 | |||||||
135 | $form->image('image', __('admin.carousels.image'))->uniqueName()->move("static/img/carousel")->required(); |
||||||
136 | |||||||
137 | $form->text('url', __('admin.carousels.url'))->icon('MDI link-variant')->required(); |
||||||
138 | $form->text('title', __('admin.carousels.title'))->icon('MDI format-title'); |
||||||
139 | $form->switch('available', __('admin.carousels.availability'))->default(true); |
||||||
140 | |||||||
141 | return $form; |
||||||
142 | } |
||||||
143 | } |
||||||
144 |