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;
class Category extends CubistMagicNestedModel
{
- protected $table = 'categories';
+ protected $table = 'catalog_categories';
protected $_options = ['name' => 'category',
'plural' => 'categories'];
class Product extends CubistMagicModel
{
- protected $table = 'products';
+ protected $table = 'catalog_products';
protected $_options = ['name' => 'product',
'plural' => 'products'];
'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',
<?php
+
namespace App\Models;
use Cubist\Backpack\app\Magic\Models\CubistMagicModel;
class ProductType extends CubistMagicModel
{
- protected $table = 'product_types';
+ protected $table = 'catalog_product_types';
protected $_options = ['name' => 'product type',
+ 'route' => 'producttype',
'plural' => 'product types'];
public function setFields()
class Specification extends CubistMagicModel
{
- protected $table = 'specifications';
+ protected $table = 'catalog_specifications';
protected $_options = ['name' => 'specification',
'plural' => 'specifications'];
<li class="header">Catalog edition</li>
<li><a href='{{ backpack_url('product') }}'><i class='fa fa-book'></i> <span>Products</span></a></li>
<li><a href='{{ backpack_url('producttype') }}'><i class='fa fa-wpforms'></i> <span>Product types</span></a></li>
- <li><a href='{{ backpack_url('specifications') }}'><i class='fa fa-align-left'></i> <span>Specifications</span></a>
+ <li><a href='{{ backpack_url('specification') }}'><i class='fa fa-align-left'></i> <span>Specifications</span></a>
</li>
<li><a href='{{ backpack_url('category') }}'><i class='fa fa-folder-open'></i> <span>Categories</span></a></li>
@endcan
'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