From: Vincent Vanwaelscappel Date: Mon, 3 Jun 2019 14:59:52 +0000 (+0200) Subject: wip #2810 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=11b239e0dd74a03648ed0d9c7b7dfed562ab90d0;p=pmi.git wip #2810 @2 --- diff --git a/app/Http/Controllers/Admin/ProductTypeCrudController.php b/app/Http/Controllers/Admin/ProductTypeCrudController.php index 8c6e381..5cde01c 100644 --- a/app/Http/Controllers/Admin/ProductTypeCrudController.php +++ b/app/Http/Controllers/Admin/ProductTypeCrudController.php @@ -7,7 +7,7 @@ use Cubist\Backpack\app\Magic\Controllers\CubistMagicController; class ProductTypeCrudController extends CubistMagicController { protected $_modelNamespace = 'App\Models\ProductType'; - protected $_routeURL = 'product type'; + protected $_routeURL = 'producttype'; protected $_singular = 'product type'; protected $_plural = 'product types'; protected $_clonable = true; diff --git a/app/Models/Category.php b/app/Models/Category.php index 12b31f5..372fe12 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -6,7 +6,7 @@ use Cubist\Backpack\app\Magic\Models\CubistMagicNestedModel; class Category extends CubistMagicNestedModel { - protected $table = 'categories'; + protected $table = 'catalog_categories'; protected $_options = ['name' => 'category', 'plural' => 'categories']; diff --git a/app/Models/Product.php b/app/Models/Product.php index 938ccb0..4661e4e 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -6,7 +6,7 @@ use Cubist\Backpack\app\Magic\Models\CubistMagicModel; class Product extends CubistMagicModel { - protected $table = 'products'; + protected $table = 'catalog_products'; protected $_options = ['name' => 'product', 'plural' => 'products']; @@ -27,6 +27,11 @@ class Product extends CubistMagicModel 'unique' => true, 'translatable' => false]); + $this->addField(['name' => 'product_type', + 'label' => 'Type de produit', + 'type' => 'SelectFromModel', + 'model' => 'App\Models\ProductType']); + $this->addField(['name' => 'slug', 'type' => 'Slug', 'label' => 'Slug', diff --git a/app/Models/Producttype.php b/app/Models/Producttype.php index 9b2ed57..499a3c5 100644 --- a/app/Models/Producttype.php +++ b/app/Models/Producttype.php @@ -1,13 +1,15 @@ 'product type', + 'route' => 'producttype', 'plural' => 'product types']; public function setFields() diff --git a/app/Models/Specification.php b/app/Models/Specification.php index 7da59de..39be656 100644 --- a/app/Models/Specification.php +++ b/app/Models/Specification.php @@ -7,7 +7,7 @@ use Cubist\Backpack\app\Magic\Models\CubistMagicModel; class Specification extends CubistMagicModel { - protected $table = 'specifications'; + protected $table = 'catalog_specifications'; protected $_options = ['name' => 'specification', 'plural' => 'specifications']; diff --git a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php index 880aec5..5fde756 100644 --- a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php +++ b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php @@ -26,7 +26,7 @@
  • Catalog edition
  • Products
  • Product types
  • -
  • Specifications +
  • Specifications
  • Categories
  • @endcan diff --git a/routes/backpack/custom.php b/routes/backpack/custom.php index a344983..b9d58b5 100644 --- a/routes/backpack/custom.php +++ b/routes/backpack/custom.php @@ -5,7 +5,7 @@ Route::group([ 'namespace' => 'App\Http\Controllers\Admin', ], function () { // custom admin routes CRUD::resource('category', 'CategoryCrudController'); -CRUD::resource('product', 'ProductCrudController'); -CRUD::resource('product type', 'ProductTypeCrudController'); -CRUD::resource('specification', 'SpecificationCrudController'); + CRUD::resource('product', 'ProductCrudController'); + CRUD::resource('producttype', 'ProductTypeCrudController'); + CRUD::resource('specification', 'SpecificationCrudController'); }); // this should be the absolute last line of this file