'widget_id', 'type' => 'text', 'label' => 'OpenWidget ID', 'description' => 'Your OpenWidget organization ID (from the OpenWidget configurator).', 'required' => true, 'value' => $values['widget_id'] ?? '', ], [ 'name' => 'show_on_admin', 'type' => 'checkbox', 'label' => 'Show on Admin Panel', 'description' => 'Enable OpenWidget on admin panel pages.', 'required' => false, 'value' => $values['show_on_admin'] ?? false, ], ]; } public function boot(): void { if (!request()->isMethod('GET')) { return; } // I think that it's questionable if you want this on admin pages.... if (request()->is('admin*') && !$this->config('show_on_admin', false)) { return; } $this->injectWidget(); } private function injectWidget(): void { if (!function_exists('app') || !app()->bound('view')) return; echo $this->getWidgetScript(); } private function getWidgetScript(): string { static $injected = false; if ($injected) return ''; $injected = true; $widgetId = $this->config('widget_id', ''); if (empty($widgetId)) { return ""; } return << HTML; } public function enabled(): void {} public function disabled(): void {} public function updated(): void {} public function install(): void { // Send it to the void! } }