namespace App\Http\Controllers\Admin;
-use Cubist\Backpack\app\Magic\Controllers\CubistNestedMagicController;
+use Cubist\Backpack\app\Magic\Controllers\CubistMagicNestedController;
-class CategoryCrudController extends CubistNestedMagicController
+class CategoryCrudController extends CubistMagicNestedController
{
protected $_modelNamespace = 'App\Models\Category';
protected $_routeURL = 'category';
protected $_singular = 'category';
protected $_plural = 'categories';
+ protected $_clonable = true;
}
protected $_routeURL = 'product';
protected $_singular = 'product';
protected $_plural = 'products';
+ protected $_clonable = true;
}
--- /dev/null
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use Cubist\Backpack\app\Magic\Controllers\CubistMagicController;
+
+class ProductTypeCrudController extends CubistMagicController
+{
+ protected $_modelNamespace = 'App\Models\ProductType';
+ protected $_routeURL = 'product type';
+ protected $_singular = 'product type';
+ protected $_plural = 'product types';
+ protected $_clonable = true;
+}
--- /dev/null
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use Cubist\Backpack\app\Magic\Controllers\CubistMagicController;
+
+class SpecificationCrudController extends CubistMagicController
+{
+ protected $_modelNamespace = 'App\Models\Specification';
+ protected $_routeURL = 'specification';
+ protected $_singular = 'specification';
+ protected $_plural = 'specifications';
+ protected $_clonable = true;
+}
+++ /dev/null
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use Cubist\Backpack\app\Magic\Controllers\CubistMagicController;
-
-class SpecificationsCrudController extends CubistMagicController
-{
- protected $_modelNamespace = 'App\Models\Specification';
- protected $_routeURL = 'specifications';
- protected $_singular = 'specifications';
- protected $_plural = 'products';
-}
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
- \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
+ //\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
\Spatie\MissingPageRedirector\RedirectsMissingPages::class,
];
namespace App\Models;
-use Cubist\Backpack\app\Magic\Models\CubistMagicModel;
+use Cubist\Backpack\app\Magic\Models\CubistMagicNestedModel;
-class Category extends CubistMagicModel
+class Category extends CubistMagicNestedModel
{
protected $table = 'categories';
protected $_options = ['name' => 'category',
'plural' => 'categories'];
- protected $nested = true;
-
public function setFields()
{
parent::setFields();
$this->addField(['name' => 'slug',
'type' => 'Slug',
'label' => 'Slug',
- 'column' => true]);
+ 'column' => true]
+ );
}
protected $_options = ['name' => 'product',
'plural' => 'products'];
- protected $nested = false;
-
public function setFields()
{
parent::setFields();
'label' => 'SKU',
'type' => 'Text',
'column' => true,
- 'unique' => true]);
+ 'unique' => true,
+ 'translatable' => false]);
$this->addField(['name' => 'slug',
'type' => 'Slug',
$this->addField(['name' => 'supplier',
'label' => 'Supplier',
- 'type' => 'Text']);
+ 'type' => 'Text',
+ 'translatable' => false]);
$this->addField(['name' => 'supplier_reference',
'label' => 'Supplier reference',
- 'type' => 'Text']);
+ 'type' => 'Text',
+ 'translatable' => false]);
$this->addField(['name' => 'highlights',
'label' => 'Product highlights',
$this->addField(['name' => 'accessories',
'label' => 'Accessories',
'type' => 'Markdown']);
-
}
}
--- /dev/null
+<?php
+namespace App\Models;
+
+use Cubist\Backpack\app\Magic\Models\CubistMagicModel;
+
+class ProductType extends CubistMagicModel
+{
+ protected $table = 'product_types';
+
+ protected $_options = ['name' => 'product type',
+ 'plural' => 'product types'];
+
+ public function setFields()
+ {
+ $this->addField(['name' => 'name',
+ 'label' => 'Type name',
+ 'type' => 'Text',
+ 'column' => true]);
+
+ $this->addField(['name' => 'specifications',
+ 'label' => 'Specifications',
+ 'type' => 'SelectFromModelMultiple',
+ 'model' => "App\Models\Specification",
+ ]);
+ }
+}
{
protected $table = 'specifications';
- protected $_options = ['name' => 'specifications',
- 'plural' => 'products'];
+ protected $_options = ['name' => 'specification',
+ 'plural' => 'specifications'];
public function setFields()
{
// Can be a single class or an array of clases
'middleware_class' => [
App\Http\Middleware\CheckIfAdmin::class,
- \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
+ //\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
Backpack\Base\app\Http\Middleware\UseBackpackAuthGuardInsteadOfDefaultAuthGuard::class,
],
// Here you may override the css-classes for the content section of the edit view globally
// To override per view use $this->crud->setEditContentClass('class-string')
- 'edit_content_class' => 'col-md-8 col-md-offset-2',
+ 'edit_content_class' => 'col-md-8 col-md-offset-2',
// Here you may override the css-classes for the content section of the revisions timeline view globally
// To override per view use $this->crud->setRevisionsTimelineContentClass('class-string')
- 'revisions_timeline_content_class' => 'col-md-10 col-md-offset-1',
+ 'revisions_timeline_content_class' => 'col-md-10 col-md-offset-1',
/*
|------------
// Here you may override the css-classes for the content section of the show view globally
// To override per view use $this->crud->setShowContentClass('class-string')
- 'show_content_class' => 'col-md-8 col-md-offset-2',
+ 'show_content_class' => 'col-md-8 col-md-offset-2',
/*
|------------
// Here you may override the css-classes for the content section of the reorder view globally
// To override per view use $this->crud->setReorderContentClass('class-string')
- 'reorder_content_class' => 'col-md-8 col-md-offset-2',
+ 'reorder_content_class' => 'col-md-8 col-md-offset-2',
/*
|------------
// "de_LI" => "German (Liechtenstein)",
// "de_LU" => "German (Luxembourg)",
// "de_CH" => "German (Switzerland)",
- // "de" => "German",
+ "de" => "German",
// "el_CY" => "Greek (Cyprus)",
// "el_GR" => "Greek (Greece)",
// "el" => "Greek",
// "ga" => "Irish",
// "it_IT" => "Italian (Italy)",
// "it_CH" => "Italian (Switzerland)",
- 'it' => 'Italian',
+ //'it' => 'Italian',
// "ja_JP" => "Japanese (Japan)",
// "ja" => "Japanese",
// "kea_CV" => "Kabuverdianu (Cape Verde)",
// "pa" => "Punjabi",
// "ro_MD" => "Romanian (Moldova)",
// "ro_RO" => "Romanian (Romania)",
- 'ro' => 'Romanian',
+ //'ro' => 'Romanian',
// "rm_CH" => "Romansh (Switzerland)",
// "rm" => "Romansh",
// "rof_TZ" => "Rombo (Tanzania)",
], function () { // custom admin routes
CRUD::resource('category', 'CategoryCrudController');
CRUD::resource('product', 'ProductCrudController');
-CRUD::resource('specifications', 'SpecificationsCrudController');
+CRUD::resource('product type', 'ProductTypeCrudController');
+CRUD::resource('specification', 'SpecificationCrudController');
}); // this should be the absolute last line of this file