]> _ Git - pmi.git/commitdiff
wip #2810 @14
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 31 May 2019 09:31:14 +0000 (11:31 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 31 May 2019 09:31:14 +0000 (11:31 +0200)
app/Models/Category.php
app/Models/Product.php [new file with mode: 0644]
app/Models/Specification.php [new file with mode: 0644]

index 9e0b378b24e28bbc96a4de18b45dc36673d27bbd..1de50b3e47b72762c657fa341241bb9cfc413dfd 100644 (file)
@@ -11,6 +11,8 @@ class Category extends CubistMagicModelAbstract
     protected $_options = ['name' => 'category',
         'plural' => 'categories'];
 
+    protected $nested = true;
+
     public function setFields()
     {
         parent::setFields();
diff --git a/app/Models/Product.php b/app/Models/Product.php
new file mode 100644 (file)
index 0000000..0d5516c
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+
+namespace App\Models;
+
+use Cubist\Backpack\app\Magic\Models\CubistMagicModel;
+
+class Product extends CubistMagicModel
+{
+    protected $table = 'products';
+
+    protected $_options = ['name' => 'product',
+        'plural' => 'products'];
+
+    protected $nested = false;
+
+    public function setFields()
+    {
+        parent::setFields();
+
+        $this->addField(['name' => 'name',
+            'label' => 'Product name',
+            'type' => 'Text',
+            'column' => true]);
+
+        $this->addField(['name' => 'reference',
+            'label' => 'SKU',
+            'type' => 'Text',
+            'column' => true,
+            'unique' => true]);
+
+        $this->addField(['name' => 'slug',
+            'type' => 'Slug',
+            'label' => 'Slug',
+            'column' => true]);
+
+        $this->addField(['name' => 'online',
+            'type' => 'Checkbox',
+            'label' => 'Online',
+            'column' => true]);
+
+        $this->addField(['name' => 'public',
+            'type' => 'Checkbox',
+            'label' => 'Public',
+            'column' => true]);
+
+        $this->addField(['name' => 'supplier',
+            'label' => 'Supplier',
+            'type' => 'Text']);
+
+        $this->addField(['name' => 'supplier_reference',
+            'label' => 'Supplier reference',
+            'type' => 'Text']);
+
+        $this->addField(['name' => 'highlights',
+            'label' => 'Product highlights',
+            'type' => 'Markdown']);
+
+        $this->addField(['name' => 'descriptions',
+            'label' => 'Description',
+            'type' => 'Markdown']);
+
+        $this->addField(['name' => 'images',
+            'label' => 'Product pictures',
+            'type' => 'Images']);
+
+        $this->addField(['name' => 'dimensions',
+            'label' => 'Dimensions',
+            'type' => 'Markdown']);
+
+        $this->addField(['name' => 'options',
+            'label' => 'Options',
+            'type' => 'Markdown']);
+
+        $this->addField(['name' => 'accessories',
+            'label' => 'Accessories',
+            'type' => 'Markdown']);
+
+    }
+}
diff --git a/app/Models/Specification.php b/app/Models/Specification.php
new file mode 100644 (file)
index 0000000..a7c512a
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+
+namespace App\Models;
+
+use Cubist\Backpack\app\Magic\Models\CubistMagicModel;
+
+class Specification extends CubistMagicModel
+{
+    protected $table = 'specifications';
+
+    protected $_options = ['name' => 'specifications',
+        'plural' => 'products'];
+
+    public function setFields()
+    {
+        parent::setFields();
+
+        $this->addField(['name' => 'name',
+            'label' => 'Specification name',
+            'type' => 'Text',
+            'column' => true]);
+
+        $this->addField(['name' => 'type',
+            'label' => 'Type',
+            'type' => 'SelectFromArray',
+            'column' => true,
+            'options' => ['numeric' => 'Numeric value', 'list' => 'Value in a list']]);
+
+        $this->addField(['name' => 'options',
+            'label' => 'Options',
+            'type' => 'Table',
+            'entity_singular' => 'option', // used on the "Add X" button
+            'columns' => [
+                'name' => 'Name',
+            ],]);
+    }
+}