jqh vor 5 Jahren
Ursprung
Commit
7db5b8afba
2 geänderte Dateien mit 14 neuen und 14 gelöschten Zeilen
  1. 1 1
      src/Controllers/PermissionController.php
  2. 13 13
      src/Show.php

+ 1 - 1
src/Controllers/PermissionController.php

@@ -243,7 +243,7 @@ class PermissionController extends Controller
     {
         $show = new Show(new Permission());
 
-        $show->setId($id);
+        $show->setKey($id);
 
         $show->id;
         $show->slug;

+ 13 - 13
src/Show.php

@@ -178,9 +178,22 @@ class Show implements Renderable
      */
     public function model()
     {
+        if (! $this->model) {
+            $this->setupModel();
+        }
+
         return $this->model;
     }
 
+    protected function setupModel()
+    {
+        if ($this->repository) {
+            $this->setModel(new Fluent($this->repository->detail($this)));
+        } else {
+            $this->setModel(new Fluent());
+        }
+    }
+
     /**
      * Set a view to render.
      *
@@ -581,17 +594,6 @@ class Show implements Renderable
         return false;
     }
 
-    protected function setupModel()
-    {
-        if ($this->repository && ! $this->model) {
-            $this->setModel(new Fluent($this->repository->detail($this)));
-        }
-
-        if (! $this->model) {
-            $this->setModel(new Fluent());
-        }
-    }
-
     /**
      * Render the show panels.
      *
@@ -600,8 +602,6 @@ class Show implements Renderable
     public function render()
     {
         try {
-            $this->setupModel();
-
             $model = $this->model();
 
             if (is_callable($this->builder)) {