byos_laravel/app/Livewire/Actions/DeviceAutoJoin.php
Benjamin Nussbaum 715e6a2562 add features
* feat: autojoin toggle
* feat: auto add devices
* feat: proxy feature
* feat: support puppeteer in docker
* feat: toggle to activate cloud proxy
* feat: relay device information
* feat: relay logs to cloud
* feat: migrate on start
* feat: calculate battery state, wifi signal
* feat: eye candy for configure view
* feat: update via api
2025-03-03 21:24:22 +01:00

37 lines
745 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()
{
$this->deviceAutojoin = auth()->user()->assign_new_devices;
$this->isFirstUser = auth()->user()->id === 1;
}
public function updating($name, $value)
{
$this->validate([
'deviceAutojoin' => 'boolean',
]);
if ($name === 'deviceAutojoin') {
auth()->user()->update([
'assign_new_devices' => $value,
]);
}
}
public function render()
{
return view('livewire.actions.device-auto-join');
}
}