From: Stephen Cameron Date: Wed, 5 Jan 2022 17:21:27 +0000 (+0100) Subject: Fixes to make site compatible with Composer v2+. WIP #4981 @3 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=85c911015b3373964b664d6cee704e0e7ae55114;p=pmi.git Fixes to make site compatible with Composer v2+. WIP #4981 @3 --- diff --git a/app/Models/ProductType.php b/app/Models/ProductType.php new file mode 100644 index 0000000..8928224 --- /dev/null +++ b/app/Models/ProductType.php @@ -0,0 +1,94 @@ + '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 index 8928224..0000000 --- a/app/Models/Producttype.php +++ /dev/null @@ -1,94 +0,0 @@ - '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/composer.json b/composer.json index 67e076e..5830d4d 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,9 @@ "App\\": "app/" }, "classmap": [ + "vendor/cubist/cms-back", + "vendor/cubist/gtag", + "vendor/gaspertrix/laravel-backpack-dropzone-field", "database/seeds", "database/factories" ]