mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
This commit is contained in:
parent
c67a182cf2
commit
b4b6286172
89 changed files with 672 additions and 666 deletions
|
|
@ -42,15 +42,14 @@ class FirmwareUpdateCommand extends Command
|
|||
label: 'Which devices should be updated?',
|
||||
options: [
|
||||
'all' => 'ALL Devices',
|
||||
...Device::all()->mapWithKeys(function ($device) {
|
||||
...Device::all()->mapWithKeys(fn ($device): array =>
|
||||
// without _ returns index
|
||||
return ["_$device->id" => "$device->name (Current version: $device->last_firmware_version)"];
|
||||
})->toArray(),
|
||||
["_$device->id" => "$device->name (Current version: $device->last_firmware_version)"])->toArray(),
|
||||
],
|
||||
scroll: 10
|
||||
);
|
||||
|
||||
if (empty($devices)) {
|
||||
if ($devices === []) {
|
||||
$this->error('No devices selected. Aborting.');
|
||||
|
||||
return;
|
||||
|
|
@ -59,9 +58,7 @@ class FirmwareUpdateCommand extends Command
|
|||
if (in_array('all', $devices)) {
|
||||
$devices = Device::pluck('id')->toArray();
|
||||
} else {
|
||||
$devices = array_map(function ($selected) {
|
||||
return (int) str_replace('_', '', $selected);
|
||||
}, $devices);
|
||||
$devices = array_map(fn ($selected): int => (int) str_replace('_', '', $selected), $devices);
|
||||
}
|
||||
|
||||
foreach ($devices as $deviceId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue