ZsgsDesign /
NOJ
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\User; |
||||
| 6 | use App\Http\Controllers\Controller; |
||||
| 7 | use Encore\Admin\Controllers\HasResourceActions; |
||||
| 8 | use Encore\Admin\Form; |
||||
| 9 | use Encore\Admin\Grid; |
||||
| 10 | use Encore\Admin\Layout\Content; |
||||
| 11 | use Encore\Admin\Show; |
||||
| 12 | |||||
| 13 | class UserController extends Controller |
||||
| 14 | { |
||||
| 15 | use HasResourceActions; |
||||
| 16 | |||||
| 17 | /** |
||||
| 18 | * Index interface. |
||||
| 19 | * |
||||
| 20 | * @param Content $content |
||||
| 21 | * @return Content |
||||
| 22 | */ |
||||
| 23 | public function index(Content $content) |
||||
| 24 | { |
||||
| 25 | return $content |
||||
| 26 | ->header(__('admin.users.index.header')) |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 27 | ->description(__('admin.users.index.description')) |
||||
|
0 ignored issues
–
show
It seems like
__('admin.users.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...
|
|||||
| 28 | ->body($this->grid()->render()); |
||||
| 29 | } |
||||
| 30 | |||||
| 31 | /** |
||||
| 32 | * Show interface. |
||||
| 33 | * |
||||
| 34 | * @param mixed $id |
||||
| 35 | * @param Content $content |
||||
| 36 | * @return Content |
||||
| 37 | */ |
||||
| 38 | public function show($id, Content $content) |
||||
| 39 | { |
||||
| 40 | return $content |
||||
| 41 | ->header(__('admin.users.show.header')) |
||||
|
0 ignored issues
–
show
It seems like
__('admin.users.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...
|
|||||
| 42 | ->description(__('admin.users.show.description')) |
||||
|
0 ignored issues
–
show
It seems like
__('admin.users.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...
|
|||||
| 43 | ->body($this->detail($id)); |
||||
| 44 | } |
||||
| 45 | |||||
| 46 | /** |
||||
| 47 | * Edit interface. |
||||
| 48 | * |
||||
| 49 | * @param mixed $id |
||||
| 50 | * @param Content $content |
||||
| 51 | * @return Content |
||||
| 52 | */ |
||||
| 53 | public function edit($id, Content $content) |
||||
| 54 | { |
||||
| 55 | return $content |
||||
| 56 | ->header(__('admin.users.edit.header')) |
||||
|
0 ignored issues
–
show
It seems like
__('admin.users.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...
|
|||||
| 57 | ->description(__('admin.users.edit.description')) |
||||
|
0 ignored issues
–
show
It seems like
__('admin.users.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...
|
|||||
| 58 | ->body($this->form()->edit($id)); |
||||
| 59 | } |
||||
| 60 | |||||
| 61 | /** |
||||
| 62 | * Create interface. |
||||
| 63 | * |
||||
| 64 | * @param Content $content |
||||
| 65 | * @return Content |
||||
| 66 | */ |
||||
| 67 | public function create(Content $content) |
||||
| 68 | { |
||||
| 69 | return $content |
||||
| 70 | ->header(__('admin.users.create.header')) |
||||
|
0 ignored issues
–
show
It seems like
__('admin.users.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...
|
|||||
| 71 | ->description(__('admin.users.create.description')) |
||||
|
0 ignored issues
–
show
It seems like
__('admin.users.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...
|
|||||
| 72 | ->body($this->form()); |
||||
| 73 | } |
||||
| 74 | |||||
| 75 | /** |
||||
| 76 | * Make a grid builder. |
||||
| 77 | * |
||||
| 78 | * @return Grid |
||||
| 79 | */ |
||||
| 80 | protected function grid() |
||||
| 81 | { |
||||
| 82 | $grid=new Grid(new User); |
||||
| 83 | $grid->id('ID')->sortable(); |
||||
| 84 | $grid->name(__('admin.users.name'))->editable(); |
||||
| 85 | $grid->email(__('admin.users.email')); |
||||
| 86 | $grid->created_at(__('admin.created_at')); |
||||
| 87 | $grid->updated_at(__('admin.updated_at')); |
||||
| 88 | $grid->filter(function(Grid\Filter $filter) { |
||||
| 89 | $filter->disableIdFilter(); |
||||
| 90 | $filter->like('name', __('admin.users.name')); |
||||
| 91 | $filter->like('email', __('admin.users.email'))->email(); |
||||
| 92 | }); |
||||
| 93 | return $grid; |
||||
| 94 | } |
||||
| 95 | |||||
| 96 | /** |
||||
| 97 | * Make a show builder. |
||||
| 98 | * |
||||
| 99 | * @param mixed $id |
||||
| 100 | * @return Show |
||||
| 101 | */ |
||||
| 102 | protected function detail($id) |
||||
| 103 | { |
||||
| 104 | $show=new Show(User::findOrFail($id)); |
||||
| 105 | return $show; |
||||
| 106 | } |
||||
| 107 | |||||
| 108 | /** |
||||
| 109 | * Make a form builder. |
||||
| 110 | * |
||||
| 111 | * @return Form |
||||
| 112 | */ |
||||
| 113 | protected function form() |
||||
| 114 | { |
||||
| 115 | $form=new Form(new User); |
||||
| 116 | $form->model()->makeVisible('password'); |
||||
| 117 | $form->tab(__('admin.users.basic'), function(Form $form) { |
||||
|
0 ignored issues
–
show
It seems like
__('admin.users.basic') can also be of type array and array; however, parameter $title of Encore\Admin\Form::tab() 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...
|
|||||
| 118 | if ($form->isEditing()) { |
||||
| 119 | $form->display('id', 'ID'); |
||||
| 120 | } |
||||
| 121 | $form->text('name', __('admin.users.name'))->rules('required'); |
||||
| 122 | $form->email('email', __('admin.users.email'))->rules('required'); |
||||
| 123 | if ($form->isEditing()) { |
||||
| 124 | $form->display('created_at', __('admin.created_at')); |
||||
| 125 | $form->display('updated_at', __('admin.updated_at')); |
||||
| 126 | } |
||||
| 127 | })->tab(__('admin.users.password'), function(Form $form) { |
||||
| 128 | $form->password('password', __('admin.password'))->rules('confirmed'); |
||||
| 129 | $form->password('password_confirmation', __('admin.password_confirmation')); |
||||
| 130 | }); |
||||
| 131 | $form->ignore(['password_confirmation']); |
||||
| 132 | $form->saving(function(Form $form) { |
||||
| 133 | if ($form->password && $form->model()->password!=$form->password) { |
||||
| 134 | $form->password=bcrypt($form->password); |
||||
|
0 ignored issues
–
show
It seems like
$form->password can also be of type array; however, parameter $value of bcrypt() 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...
|
|||||
| 135 | } |
||||
| 136 | }); |
||||
| 137 | return $form; |
||||
| 138 | } |
||||
| 139 | } |
||||
| 140 |