mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
37 lines
825 B
PHP
37 lines
825 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Actions;
|
|
|
|
use Livewire\Component;
|
|
|
|
class DeviceAutoJoin extends Component
|
|
{
|
|
public bool $deviceAutojoin = false;
|
|
|
|
public bool $isFirstUser = false;
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->deviceAutojoin = auth()->user()->assign_new_devices;
|
|
$this->isFirstUser = auth()->user()->id === 1;
|
|
|
|
}
|
|
|
|
public function updating($name, $value): void
|
|
{
|
|
$this->validate([
|
|
'deviceAutojoin' => 'boolean',
|
|
]);
|
|
|
|
if ($name === 'deviceAutojoin') {
|
|
auth()->user()->update([
|
|
'assign_new_devices' => $value,
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function render(): \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
|
{
|
|
return view('livewire.actions.device-auto-join');
|
|
}
|
|
}
|