/**
  * Store a newly created barang in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Barang::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['berat'] = 1;
     $data['stok'] = 1;
     if (Input::hasFile('gambar')) {
         $image = Input::file('gambar');
         $filename = date('Y-m-d') . '-' . $image->getClientOriginalName();
         $path = public_path('img/barangs/' . $filename);
         Image::make($image->getRealPath())->resize(450, 600)->save($path);
         $data['gambar'] = 'img/barangs/' . $filename;
     }
     Barang::create($data);
     return Redirect::to('admin/categories/1')->with('message', 'Barang berhasil ditambahkan');
 }