Inheritance: extends Baum\Node
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);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $locations = Location::orderBy('name')->lists('name', 'id');
     $movements = DB::table('inventory_stock_movements')->orderBy('created_at', 'desc')->limit(5)->get();
     return view('stockin.index', compact('locations', 'movements'));
 }
Esempio n. 3
0
 /**
  * @return Location
  */
 protected function newLocation()
 {
     return Location::create(['name' => 'Warehouse', 'belongs_to' => '']);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $input = Input::all();
     Location::find($id)->update($input);
     return Redirect::route('location.index')->with('message', 'Location updated.');
 }
Esempio n. 5
0
 public function testInventoryMoveItemStock()
 {
     $this->newInventoryStock();
     $locationFrom = Location::find(1);
     $locationTo = new Location();
     $locationTo->name = 'New Location';
     $locationTo->save();
     $item = Inventory::find(1);
     $item->moveStock($locationFrom, $locationTo);
     $stock = InventoryStock::find(1);
     $this->assertEquals(2, $stock->location_id);
 }