Esempio n. 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $bomhead = Bomhead::findOrNew($id);
     $parentItem = Item::findOrFail($id);
     $bomitems = Bomitem::latest('created_at')->where('parent_item_id', $id)->with('parentitem')->get();
     return view('product.boms.edit', compact('bomhead', 'parentItem', 'bomitems'));
 }
Esempio n. 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // 通过删除itemsite,同时删除了item
     $item = Item::findOrFail($id);
     $itemsite = $item->itemsite;
     if ($itemsite != null) {
         Itemsite::destroy($itemsite->id);
     }
     Item::destroy($id);
     return redirect('product/items');
 }