devices = auth()->user()->devices->pluck('id', 'name'); } public function submit() { $this->isLoading = true; $this->validate([ 'checked_devices' => 'required|array', 'blade_code' => 'required|string' ]); //only devices that are owned by the user $this->checked_devices = array_intersect($this->checked_devices, auth()->user()->devices->pluck('id')->toArray()); try { $rendered = Blade::render($this->blade_code); foreach ($this->checked_devices as $device) { GenerateScreenJob::dispatchSync($device, $rendered); } } catch (\Exception $e) { $this->addError('error', $e->getMessage()); } $this->isLoading = false; } public function renderExample(string $example) { switch ($example) { case 'helloWorld': $markup = $this->renderHelloWorld(); break; case 'quote': $markup = $this->renderQuote(); break; case 'trainMonitor': $markup = $this->renderTrainMonitor(); break; case 'homeAssistant': $markup = $this->renderHomeAssistant(); break; default: $markup = '

Hello World!

'; break; } $this->blade_code = $markup; } public function renderHelloWorld(): string { return << TRMNL BYOS Laravel “This screen was rendered by BYOS Laravel” Benjamin Nussbaum HTML; } public function renderQuote(): string { return << Motivational Quote “I love inside jokes. I hope to be a part of one someday.” Michael Scott HTML; } public function renderTrainMonitor() { return << Abfahrt Aktuell Zug Ziel Steig 08:51 08:52 REX 1 Vienna Main Station 3 HTML; } public function renderHomeAssistant() { return << 23.3° 47.52 % Sensor 1 HTML; } }; ?>

Markup Plugin

{{--
--}}
@foreach($devices as $name => $id) @endforeach Generate Screen
{{--
--}}