/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(ItemCategoryRequest $request) { //dd($request); $itemCategory = new ItemCategory(['code' => $request->get('code'), 'name' => $request->get('name'), 'description' => $request->get('description')]); $itemCategory->save(); return redirect('/wims/items/category')->with('saved', 'Success! New Category Item Saved!'); }
public function itemProfile($item_id) { $iteminfo = Item::whereId($item_id)->first(); $uoms = Uom::where('active', 'Y')->get(); $catt = ItemCategory::all(); $categories = ItemCategory::all(); $categories_pack = []; foreach ($categories as $category) { $subcategories = ItemSubcategory::where('parent', $category->id)->orderBy('parent', 'asc')->lists('name'); $categories_pack[$category->id] = $subcategories; } $jsonified = json_encode($categories_pack); $data = ['categories' => $jsonified]; $inventory_types = InventoryType::all(); $bulkunits = BulkUnit::where('item_id', $item_id)->where('active', 'Active')->get(); $bulkunits2 = BulkPackaging::where('item_id', $item_id)->where('active', 'Active')->get(); $dropdownbulkunit = BulkUnit::where('item_id', $item_id)->where('type', 'base')->where('active', 'Active')->get(); $bulkid = BulkUnit::where('item_id', $item_id)->where('type', 'base')->first(); $id2 = Request::input('id'); $id = $iteminfo->id; $trapPurchaseOrder = count(PurchaseDetails::where('item_id', $id)->get()); $trapSalesOrder = count(SalesOrder::where('item_id', $id)->get()); return View('operations/profile', $data, compact('inventory_types', 'catt', 'iteminfo', 'uoms', 'subcategories', 'itemcatsub', 'bulkunits', 'bulkunits2', 'dropdownbulkunit', 'updatebulkunits', 'bulkid', 'trapPurchaseOrder', 'trapSalesOrder', 'getbasename')); }
public static function getAllCategories() { return \App\ItemCategory::all(); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $category = ItemCategory::findOrFail($id); $category->update($request->all()); return redirect('item_categories'); }
public function __construct() { $this->categories = ['' => 'Select'] + ItemCategory::where('is_active', 1)->lists('name', 'id')->all(); }
public function edit($id) { $item = Item::findOrFail($id); $catagories = ItemCategory::lists('cat_name', 'id'); return view('items.edit', compact('item', 'catagories')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { try { $category = ItemCategory::findOrFail($id); $category->delete(); } catch (ModelNotFoundException $ex) { Flash::error('No item category found' . $ex); return redirect()->route('store.categories.index'); } Flash::success('Item category deleted successfully'); return back(); }