Esempio n. 1
1
 public function StockCreationExample()
 {
     $metric = new Metric();
     $metric->name = 'Unit';
     $metric->symbol = 'U';
     $metric->save();
     //Now, create a category to store the inventory record under:
     $category = new Category();
     $category->name = 'VoIP';
     $category->save();
     $item = new Inventory();
     $item->metric_id = $metric->id;
     $item->category_id = $category->id;
     $item->name = 'SNOM Headset';
     $item->description = 'Very nice for the ear';
     $item->save();
     $location = new Location();
     $location->name = 'Snowball Small Stock Room';
     $location->save();
     $item->createStockOnLocation(2, $location);
     $item->createSku('PART1234');
     dd($item->sku_code);
     //$res = Inventory::findBySku(Input::get('sku'));
     //$item = Inventory::find(1);
     //dd($item);
     $supplier = new Supplier();
     //Mandatory fields
     $supplier->name = 'Miro Distribution';
     //Optional fields
     $supplier->address = 'Montague Gardens';
     $supplier->postal_code = '8000';
     $supplier->zip_code = '12345';
     $supplier->country = 'South Africa';
     $supplier->region = 'Western Cape';
     $supplier->city = 'Cape Town';
     $supplier->contact_title = 'Sales Rep';
     $supplier->contact_name = 'Mark Sparky';
     $supplier->contact_phone = '555 555-5555';
     $supplier->contact_fax = '555 555-5556';
     $supplier->contact_email = '*****@*****.**';
     $supplier->save();
     $item = Inventory::find(1);
     //$supplier = Supplier::find(1);
     $item->addSupplier($supplier);
 }