예제 #1
0
 public function select()
 {
     $category = Category::all();
     $itemType = ItemType::all();
     $data = [];
     foreach ($this->fields as $field => $default) {
         $data[$field] = old($field, $default);
     }
     return view("admin.item.select", ['category' => $category, 'itemType' => $itemType, 'data' => $data]);
 }
예제 #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $itemType = ItemType::all();
     $data = [];
     $this->fields['attr_type'] = $itemType;
     foreach ($this->fields as $field => $default) {
         $data[$field] = old($field, $default);
     }
     // $itemCat = ItemCat::all();
     return view("admin.attribute.create", $data);
     //    return view("admin.attribute.create",['attr' => $attr]);
 }
예제 #3
0
 public function index()
 {
     $itemType = ItemType::all();
     // var_dump($item);exit;
     return view('admin.itemtype.index', ['data' => $itemType]);
 }
예제 #4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //
     $attr = Attribute::findOrFail($id);
     //  var_dump($itemType);exit;
     $data = ['id' => $id];
     foreach (array_keys($this->fields) as $field) {
         $data[$field] = old($field, $attr->{$field});
     }
     $itemType = ItemType::all();
     return view('admin.attribute.edit', ['data' => $data, 'itemType' => $itemType]);
 }