mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 23:18:10 +00:00
* 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
46 lines
1,002 B
PHP
46 lines
1,002 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Jobs\GenerateScreenJob;
|
|
use Illuminate\Console\Command;
|
|
|
|
class ScreenGeneratorCommand extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'trmnl:screen:generate {deviceId=1} {view=trmnl}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Generate a screen for a terminal device';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle()
|
|
{
|
|
$deviceId = $this->argument('deviceId');
|
|
$view = $this->argument('view');
|
|
|
|
try {
|
|
$markup = view($view)->render();
|
|
} catch (\Throwable $e) {
|
|
$this->error('Failed to render view: '.$e->getMessage());
|
|
|
|
return 1;
|
|
}
|
|
|
|
GenerateScreenJob::dispatchSync($deviceId, $markup);
|
|
|
|
$this->info('Screen generation job finished.');
|
|
|
|
return 0;
|
|
}
|
|
}
|