예제 #1
0
 public function edit($id)
 {
     $last_tree_categories = ItemCategories::select('item_categories.*')->leftJoin('item_categories AS c2', 'item_categories.id', '=', 'c2.parent_id')->whereNull('c2.id')->lists('title', 'id');
     foreach ($last_tree_categories as $key => $category) {
         $last_tree_categories[$key] = $last_tree_categories[$key] . " (id:{$key})";
     }
     return view('Items.edit')->with(array('title' => $this->title, 'categories' => $last_tree_categories, 'Items' => Items::findOrFail($id), 'units' => Units::lists('title', 'id')));
 }
예제 #2
0
 public function create($itemId)
 {
     $item = Items::findOrFail($itemId);
     return view('ItemUnits.create')->with(array('title' => $this->title, 'item' => $item, 'units' => Units::whereNotIn('id', ItemUnits::where('item_id', $itemId)->lists('unit_id'))->lists('title', 'id'), 'default_unit' => ItemUnits::where(['item_id' => $itemId, 'default' => 1])->first(), 'unit_groups_list' => Units::lists('group_id', 'id'), 'unit_factors_list' => Units::lists('factor', 'id')));
 }