Skip to content

Commit 793ce04

Browse files
committed
roles checkboxes use bool instead of int
1 parent 9c2af2c commit 793ce04

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

stubs/app/Http/Livewire/Admin/Users/Edit/AdminSettings.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class AdminSettings extends Base
2424

2525
public function mount(): void
2626
{
27-
$this->isActive = (int) $this->user->is_active;
28-
$this->isOfficeLoginOnly = (int) $this->user->is_office_login_only;
27+
$this->isActive = (bool) $this->user->is_active;
28+
$this->isOfficeLoginOnly = (bool) $this->user->is_office_login_only;
2929
}
3030

3131
public function render(): View
@@ -38,8 +38,8 @@ public function render(): View
3838
protected function rules(): array
3939
{
4040
return [
41-
'isOfficeLoginOnly' => 'integer',
42-
'isActive' => 'integer'
41+
'isOfficeLoginOnly' => 'bool',
42+
'isActive' => 'bool'
4343
];
4444
}
4545

@@ -58,6 +58,7 @@ public function update(): void
5858
if (is_admin()) {
5959
$this->user->is_office_login_only = $this->isOfficeLoginOnly ? 1 : 0;
6060
$this->user->is_active = $this->isActive ? 1 : 0;
61+
$this->user->save();
6162

6263
add_user_log([
6364
'title' => "updated ".$this->user->name."'s admin settings",
@@ -68,9 +69,7 @@ public function update(): void
6869
]);
6970
}
7071

71-
$this->user->save();
72-
73-
flash('App Settings Updated!')->success();
72+
flash('Settings Updated!')->success();
7473
$this->emit('refreshProfile');
7574
}
7675
}

0 commit comments

Comments
 (0)