]> _ Git - pmi.git/commitdiff
Fixes to make site compatible with Composer v2+. WIP #4981 @3
authorStephen Cameron <stephen@cubedesigners.com>
Wed, 5 Jan 2022 17:21:27 +0000 (18:21 +0100)
committerStephen Cameron <stephen@cubedesigners.com>
Wed, 5 Jan 2022 17:21:27 +0000 (18:21 +0100)
app/Models/ProductType.php [new file with mode: 0644]
app/Models/Producttype.php [deleted file]
composer.json

diff --git a/app/Models/ProductType.php b/app/Models/ProductType.php
new file mode 100644 (file)
index 0000000..8928224
--- /dev/null
@@ -0,0 +1,94 @@
+<?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();
+    }
+}
diff --git a/app/Models/Producttype.php b/app/Models/Producttype.php
deleted file mode 100644 (file)
index 8928224..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?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();
-    }
-}
index 67e076ed3080f947c2c4e8527943655cfd07e2f5..5830d4d627159663ba1c405e4b596aa49ad37b50 100644 (file)
@@ -35,6 +35,9 @@
             "App\\": "app/"
         },
         "classmap": [
+            "vendor/cubist/cms-back",
+            "vendor/cubist/gtag",
+            "vendor/gaspertrix/laravel-backpack-dropzone-field",
             "database/seeds",
             "database/factories"
         ]