--- /dev/null
+<?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']);
+
+ }
+}
--- /dev/null
+<?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',
+ ],]);
+ }
+}