mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
This commit is contained in:
parent
a88e72b75e
commit
ba3bf31bb7
29 changed files with 2379 additions and 215 deletions
46
app/Console/Commands/FetchDeviceModelsCommand.php
Normal file
46
app/Console/Commands/FetchDeviceModelsCommand.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue