--- /dev/null
+<?php
+
+namespace App\Models;
+
+use Cubist\Backpack\app\Magic\Models\CubistMagicPageModel;
+use Illuminate\Support\Str;
+
+class ProductType extends CubistMagicPageModel
+{
+ /**
+ * @var array
+ */
+ protected $_slugFields = ['slug', 'name'];
+
+ protected $table = 'catalog_product_types';
+
+ protected $_options = ['name' => 'product type',
+ 'route' => 'producttype',
+ 'singular' => 'type de produit',
+ 'plural' => 'types de produit'
+ ];
+
+ public function getSlugOrTitleAttribute($reset = false)
+ {
+ foreach ($this->_slugFields as $item) {
+ $components = explode('+', $item);
+
+ $slug = [];
+ foreach ($components as $component) {
+ if ($reset && $component === 'slug') {
+ continue;
+ }
+ if (isset($this->$component) && $this->$component != '') {
+ $slug[] = $this->$component;
+ }
+ }
+ if (count($slug) > 0) {
+ $res = Str::slug(implode('-', $slug));
+ return $res;
+ }
+ }
+ return parent::getSlugOrTitleAttribute($reset);
+ }
+
+ public function setFields()
+ {
+ $tab = 'Type de produit';
+ $this->addField(['name' => 'name',
+ 'label' => 'Nom du type de produit',
+ 'type' => 'Text',
+ 'column' => true,
+ 'tab' => $tab
+ ]);
+
+ $this->addField([
+ 'name' => 'type',
+ 'label' => 'Famille de produits',
+ 'type' => 'SelectFromArray',
+ 'options' => ['captor' => 'Captor', 'system' => 'System'],
+ 'column' => true,
+ 'tab' => $tab,
+ ]
+ );
+
+ $this->addField(['name' => 'specifications',
+ 'label' => 'Spécifications',
+ 'type' => 'SelectFromModel',
+ 'optionsmodel' => "App\Models\Specification",
+ 'order' => true,
+ 'multiple' => true,
+ 'tab' => 'Spécifications',
+ ]);
+
+ $this->addField(['name' => 'filters',
+ 'label' => 'Spécifications utilisées comme filtre',
+ 'type' => 'SelectFromModel',
+ 'optionsmodel' => 'App\Models\Specification',
+ 'order' => true,
+ 'multiple' => true,
+ 'tab' => 'Spécifications',]);
+
+ $this->addField([
+ 'name' => 'intro',
+ 'type' => 'BunchOfFields',
+ 'bunch' => 'App\SubForms\Intro',
+ 'label' => 'Introduction',
+ 'tab' => 'Introduction',
+ 'translatable' => true,
+ ]);
+
+
+ parent::setFields();
+ }
+}
+++ /dev/null
-<?php
-
-namespace App\Models;
-
-use Cubist\Backpack\app\Magic\Models\CubistMagicPageModel;
-use Illuminate\Support\Str;
-
-class ProductType extends CubistMagicPageModel
-{
- /**
- * @var array
- */
- protected $_slugFields = ['slug', 'name'];
-
- protected $table = 'catalog_product_types';
-
- protected $_options = ['name' => 'product type',
- 'route' => 'producttype',
- 'singular' => 'type de produit',
- 'plural' => 'types de produit'
- ];
-
- public function getSlugOrTitleAttribute($reset = false)
- {
- foreach ($this->_slugFields as $item) {
- $components = explode('+', $item);
-
- $slug = [];
- foreach ($components as $component) {
- if ($reset && $component === 'slug') {
- continue;
- }
- if (isset($this->$component) && $this->$component != '') {
- $slug[] = $this->$component;
- }
- }
- if (count($slug) > 0) {
- $res = Str::slug(implode('-', $slug));
- return $res;
- }
- }
- return parent::getSlugOrTitleAttribute($reset);
- }
-
- public function setFields()
- {
- $tab = 'Type de produit';
- $this->addField(['name' => 'name',
- 'label' => 'Nom du type de produit',
- 'type' => 'Text',
- 'column' => true,
- 'tab' => $tab
- ]);
-
- $this->addField([
- 'name' => 'type',
- 'label' => 'Famille de produits',
- 'type' => 'SelectFromArray',
- 'options' => ['captor' => 'Captor', 'system' => 'System'],
- 'column' => true,
- 'tab' => $tab,
- ]
- );
-
- $this->addField(['name' => 'specifications',
- 'label' => 'Spécifications',
- 'type' => 'SelectFromModel',
- 'optionsmodel' => "App\Models\Specification",
- 'order' => true,
- 'multiple' => true,
- 'tab' => 'Spécifications',
- ]);
-
- $this->addField(['name' => 'filters',
- 'label' => 'Spécifications utilisées comme filtre',
- 'type' => 'SelectFromModel',
- 'optionsmodel' => 'App\Models\Specification',
- 'order' => true,
- 'multiple' => true,
- 'tab' => 'Spécifications',]);
-
- $this->addField([
- 'name' => 'intro',
- 'type' => 'BunchOfFields',
- 'bunch' => 'App\SubForms\Intro',
- 'label' => 'Introduction',
- 'tab' => 'Introduction',
- 'translatable' => true,
- ]);
-
-
- parent::setFields();
- }
-}
"App\\": "app/"
},
"classmap": [
+ "vendor/cubist/cms-back",
+ "vendor/cubist/gtag",
+ "vendor/gaspertrix/laravel-backpack-dropzone-field",
"database/seeds",
"database/factories"
]