]> _ Git - cubist_cms-back.git/commitdiff
#2783
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 21 May 2019 16:07:49 +0000 (18:07 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 21 May 2019 16:07:49 +0000 (18:07 +0200)
src/app/Http/Controllers/CubistCrud.php [new file with mode: 0644]
src/app/Http/Controllers/CubistCrudController.php [deleted file]
src/app/Http/Controllers/CubistModelCrudController.php
src/app/Http/Controllers/CubistPageCrudController.php

diff --git a/src/app/Http/Controllers/CubistCrud.php b/src/app/Http/Controllers/CubistCrud.php
new file mode 100644 (file)
index 0000000..1396beb
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+
+namespace Cubist\Backpack\app\Http\Controllers;
+
+trait CubistCrud
+{
+    public function addField($field, $form = 'both')
+    {
+        if (isset($field['column_label']) || isset($field['column']) && $field['column'] == true) {
+            $column_data = ['name' => $field['name'], 'label' => $field['label'], 'type' => 'text'];
+            if (isset($field['column'])) {
+                unset($field['column']);
+            }
+            if (isset($field['column_label'])) {
+                $column_data['label'] = $field['column_label'];
+                unset($field['column_label']);
+            }
+            if (isset($field['column_type'])) {
+                $column_data['type'] = $field['column_type'];
+                unset($column_data['type']);
+            }
+            $this->crud->addColumn($column_data);
+        }
+        $this->crud->addField($field, $form);
+    }
+}
diff --git a/src/app/Http/Controllers/CubistCrudController.php b/src/app/Http/Controllers/CubistCrudController.php
deleted file mode 100644 (file)
index b974569..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-
-namespace Cubist\Backpack\app\Http\Controllers;
-
-trait CubistCrudController
-{
-    public function addField($field, $form = 'both')
-    {
-        if (isset($field['column_label']) || isset($field['column']) && $field['column'] == true) {
-            $column_data = ['name' => $field['name'], 'label' => $field['label'], 'type' => 'text'];
-            if (isset($field['column'])) {
-                unset($field['column']);
-            }
-            if (isset($field['column_label'])) {
-                $column_data['label'] = $field['column_label'];
-                unset($field['column_label']);
-            }
-            if (isset($field['column_type'])) {
-                $column_data['type'] = $field['column_type'];
-                unset($column_data['type']);
-            }
-            $this->crud->addColumn($column_data);
-        }
-        $this->crud->addField($field, $form);
-    }
-}
index c944fbe9f2c53d06055b20caad1fabb7cf657e65..f4d3417b87d490dc43539d484caffb96c23849d0 100644 (file)
@@ -16,7 +16,7 @@ use Backpack\CRUD\CrudPanel;
  */
 class CubistModelCrudController extends CrudController
 {
-    use CubistCrudController;
+    use CubistCrud;
 
     public function setup()
     {
index 28e167cd25630ef4665a08243e1e19c0d58c706e..853f41466f1769876328d569677d6fc190cd7fb6 100644 (file)
@@ -8,6 +8,7 @@ use Illuminate\Support\Str;
 
 class CubistPageCrudController extends PageCrudController
 {
+    use CubistCrud;
     protected static $_templates = null;
 
     /**
@@ -38,7 +39,7 @@ class CubistPageCrudController extends PageCrudController
     /**
      * Add the fields defined for a specific template.
      *
-     * @param  string $template_name The name of the template that should be used in the current form.
+     * @param string $template_name The name of the template that should be used in the current form.
      */
     public function useTemplate($template_name = false)
     {