Skip to content

Commit 02e0f0e

Browse files
committed
Validate onSetDefault requests
Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
1 parent d0432ee commit 02e0f0e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Http/Controllers/CustomerGroups.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ public function __construct()
6565

6666
public function index_onSetDefault()
6767
{
68-
if (CustomerGroup::updateDefault(post('default'))) {
68+
$data = $this->validate(post(), [
69+
'default' => 'required|integer|exists:'.CustomerGroup::class.',customer_group_id',
70+
]);
71+
72+
if (CustomerGroup::updateDefault($data['default'])) {
6973
flash()->success(sprintf(lang('admin::lang.alert_success'), lang('igniter.user::default.customer_groups.alert_set_default')));
7074
}
7175

0 commit comments

Comments
 (0)