Skip to content

Commit

Permalink
roles checkboxes use bool instead of int
Browse files Browse the repository at this point in the history
  • Loading branch information
dcblogdev committed Dec 24, 2022
1 parent 9c2af2c commit 793ce04
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions stubs/app/Http/Livewire/Admin/Users/Edit/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class AdminSettings extends Base

public function mount(): void
{
$this->isActive = (int) $this->user->is_active;
$this->isOfficeLoginOnly = (int) $this->user->is_office_login_only;
$this->isActive = (bool) $this->user->is_active;
$this->isOfficeLoginOnly = (bool) $this->user->is_office_login_only;
}

public function render(): View
Expand All @@ -38,8 +38,8 @@ public function render(): View
protected function rules(): array
{
return [
'isOfficeLoginOnly' => 'integer',
'isActive' => 'integer'
'isOfficeLoginOnly' => 'bool',
'isActive' => 'bool'
];
}

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

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

$this->user->save();

flash('App Settings Updated!')->success();
flash('Settings Updated!')->success();
$this->emit('refreshProfile');
}
}

0 comments on commit 793ce04

Please sign in to comment.