Browse Source

fix call function model() on null

lila 4 years ago
parent
commit
ea754999ac
2 changed files with 5 additions and 3 deletions
  1. 1 1
      src/Show.php
  2. 4 2
      src/Show/Html.php

+ 1 - 1
src/Show.php

@@ -518,7 +518,7 @@ class Show implements Renderable
      */
     public function html($html = '')
     {
-        $this->fields->push(new Html($html));
+        $this->fields->push(new Html($html, $this));
     }
 
     /**

+ 4 - 2
src/Show/Html.php

@@ -3,15 +3,17 @@
 namespace Dcat\Admin\Show;
 
 use Dcat\Admin\Support\Helper;
+use Dcat\Admin\Show;
 
 class Html extends Field
 {
     public $html;
 
-    public function __construct($html, string $name = '', string $label = '')
+    public function __construct($html, Show $show, string $name = '', string $label = '')
     {
-        $this->html = $html;
         parent::__construct($name, $label);
+        $this->html = $html;
+        $this->setParent($show);
     }
 
     public function render()