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, null, $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 = '