From 793ce045adbcf0521233a522091e54d5f309b476 Mon Sep 17 00:00:00 2001 From: David Carr Date: Sat, 24 Dec 2022 13:34:29 +0000 Subject: [PATCH] roles checkboxes use bool instead of int --- .../Livewire/Admin/Users/Edit/AdminSettings.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/stubs/app/Http/Livewire/Admin/Users/Edit/AdminSettings.php b/stubs/app/Http/Livewire/Admin/Users/Edit/AdminSettings.php index 88a1699..17575a6 100644 --- a/stubs/app/Http/Livewire/Admin/Users/Edit/AdminSettings.php +++ b/stubs/app/Http/Livewire/Admin/Users/Edit/AdminSettings.php @@ -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 @@ -38,8 +38,8 @@ public function render(): View protected function rules(): array { return [ - 'isOfficeLoginOnly' => 'integer', - 'isActive' => 'integer' + 'isOfficeLoginOnly' => 'bool', + 'isActive' => 'bool' ]; } @@ -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", @@ -68,9 +69,7 @@ public function update(): void ]); } - $this->user->save(); - - flash('App Settings Updated!')->success(); + flash('Settings Updated!')->success(); $this->emit('refreshProfile'); } }