/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $data['item'] = Items::findOrFail($id);
     $data['category'] = Category::with('SubCategory')->orderby('created_at', 'asc')->get();
     $data['color'] = ItemColors::all();
     $data['size'] = ItemSize::all();
     if (is_dir(public_path() . '/uploads/photos/' . $id . '/')) {
         $photos = scandir(public_path() . '/uploads/photos/' . $id . '/', 1);
         $files = array_diff($photos, array('.', '..'));
     } else {
         $files = [];
     }
     $data['photos'] = $files;
     return view('admin.item-add', $data)->with('obj', $data);
 }
示例#2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     \App\ItemColors::destroy($id);
     return Redirect::back();
 }