Update source into github

This commit is contained in:
pbao9
2025-07-24 16:18:27 +07:00
parent 41419358dd
commit 69851ac7bc
2642 changed files with 284095 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App\Http\Livewire;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Livewire\Component;
class UserSettings extends Component
{
public bool $email_marketing;
public bool $receive_deposit;
public function mount()
{
$user = auth('users')->user();
// Gán giá trị bool từ database tinyInteger
$this->email_marketing = (bool) $user->email_marketing;
$this->receive_deposit = (bool) $user->receive_deposit;
}
public function updated($propertyName)
{
$user = auth('users')->user();
// Cập nhật database với giá trị int 0 hoặc 1
$user->update([
$propertyName => $this->$propertyName ? 1 : 0,
]);
}
public function render()
{
return view('livewire.user-settings', [
'user' => auth('users')->user(), // Truyền user để hiển thị thông tin
]);
}
}