mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 23:18:10 +00:00
chore: run pint
This commit is contained in:
parent
78f1f74594
commit
4102d33336
11 changed files with 37 additions and 37 deletions
|
|
@ -5,6 +5,7 @@ namespace App\Console\Commands;
|
|||
use App\Jobs\FirmwarePollJob;
|
||||
use App\Models\Firmware;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use function Laravel\Prompts\spin;
|
||||
use function Laravel\Prompts\table;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,27 +45,25 @@ class FirmwareUpdateCommand extends Command
|
|||
...Device::all()->mapWithKeys(function ($device) {
|
||||
// without _ returns index
|
||||
return ["_$device->id" => "$device->name (Current version: $device->last_firmware_version)"];
|
||||
})->toArray()
|
||||
})->toArray(),
|
||||
],
|
||||
scroll: 10
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (empty($devices)) {
|
||||
$this->error('No devices selected. Aborting.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (in_array('all', $devices)) {
|
||||
$devices = Device::pluck('id')->toArray();
|
||||
} else {
|
||||
$devices = array_map(function($selected) {
|
||||
$devices = array_map(function ($selected) {
|
||||
return (int) str_replace('_', '', $selected);
|
||||
}, $devices);
|
||||
}
|
||||
|
||||
|
||||
foreach ($devices as $deviceId) {
|
||||
Device::find($deviceId)->update(['update_firmware_id' => $firmwareVersion]);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
|||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CleanupDeviceLogsJob implements ShouldQueue
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,4 +44,4 @@ class FirmwareDownloadJob implements ShouldQueue
|
|||
Log::error('An unexpected error occurred: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,9 @@ class FirmwarePollJob implements ShouldQueue
|
|||
try {
|
||||
$response = Http::get('https://usetrmnl.com/api/firmware/latest')->json();
|
||||
|
||||
if (!is_array($response) || !isset($response['version']) || !isset($response['url'])) {
|
||||
if (! is_array($response) || ! isset($response['version']) || ! isset($response['url'])) {
|
||||
\Log::error('Invalid firmware response format received');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue