Пример #1
0
 /**
  * Inventory management
  * @param   integer $productId
  */
 public function inventory($productId)
 {
     $this->pageTitle = 'Manage Inventory';
     // Load the product, and fire up the inventories widget
     if ($product = Product::with('inventories')->find($productId)) {
         $this->vars['product'] = ['id' => $product->id, 'name' => $product->name];
         $inventoriesWidget = new InventoriesWidget($this);
         $inventoriesWidget->alias = 'inventoriesWidget';
         $inventoriesWidget->bindToController();
         $inventoriesWidget->setProductId($product->id);
     } else {
         $this->fatalError = 'There is no product with an ID of ' . intval($productId) . '.';
     }
 }