feat: adapt device models api
Some checks are pending
tests / ci (push) Waiting to run

This commit is contained in:
Benjamin Nussbaum 2025-08-16 09:41:00 +02:00
parent a88e72b75e
commit ba3bf31bb7
29 changed files with 2379 additions and 215 deletions

View file

@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Jobs\FetchDeviceModelsJob;
use Exception;
use Illuminate\Console\Command;
final class FetchDeviceModelsCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'device-models:fetch';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetch device models from the TRMNL API and update the database';
/**
* Execute the console command.
*/
public function handle(): int
{
$this->info('Dispatching FetchDeviceModelsJob...');
try {
FetchDeviceModelsJob::dispatchSync();
$this->info('FetchDeviceModelsJob has been dispatched successfully.');
return self::SUCCESS;
} catch (Exception $e) {
$this->error('Failed to dispatch FetchDeviceModelsJob: '.$e->getMessage());
return self::FAILURE;
}
}
}