Example #1
0
 public function __construct($params)
 {
     $this->store = $params->entity;
     $this->addField('default', ['label' => 'Default Store', 'value' => $this->store->default, 'type' => 'select', 'resource' => 'yesno']);
     $this->addField('theme', ['label' => 'Theme', 'type' => 'select', 'validate' => ['required'], 'resource' => 'themes']);
     $this->addField('root_category', ['label' => 'Root Category', 'type' => 'select', 'validate' => ['required'], 'resource' => 'root_categories']);
     parent::__construct($params);
 }
Example #2
0
 public function __construct($params)
 {
     $this->product = $params->entity;
     $this->addField('sku', ['label' => 'Sku', 'type' => 'text', 'validate' => ['required'], 'value' => $this->product->sku]);
     $this->addField('name', ['label' => 'Name', 'type' => 'text', 'validate' => ['required'], 'value' => $this->product->name]);
     $this->addField('price', ['label' => 'Price', 'type' => 'text', 'validate' => ['required'], 'value' => $this->product->price]);
     parent::__construct($params);
 }
Example #3
0
 public function __construct($params)
 {
     $this->product = $params->entity;
     $this->options['action'] = url('backend/product/categories/' . $this->product->id);
     // todo find/make a "get relationship ids" method
     $selected = [];
     foreach ($this->product->categories as $category) {
         $selected[] = $category->id;
     }
     $this->addField('categories', ['label' => 'Category Tree', 'type' => 'tree', 'value' => $selected, 'resource' => 'category_children']);
     parent::__construct($params);
 }
Example #4
0
 public function __construct($params)
 {
     /**
      * Category Name
      */
     $this->category = $params->entity;
     $this->addField('name', ['label' => 'Name', 'type' => 'text', 'validate' => ['required'], 'value' => $this->category->name]);
     $value = null;
     $validate = ['limit' => 1];
     if ($this->category->exists) {
         $parent = $this->category->parent;
         $value = $parent->exists ? $parent->id : app('store')->root_category;
         $validate['hide'] = $this->category->id;
     }
     $this->addField('parent', ['label' => 'Parent Category', 'type' => 'tree', 'value' => $value, 'resource' => 'category_tree', 'options' => ['data-validate' => $validate]]);
     parent::__construct($params);
 }