public function postCreate() { $validator = Validator::make(Input::all(), Product::$rules); if ($validator->passes()) { $product = new Product(); $product->category_id = Input::get('category_id'); $product->title = Input::get('title'); $product->description = Input::get('description'); $product->price = Input::get('price'); $image = Input::file('image'); $filename = date('Y-m-d-H-i-s') . "-" . $image->getClientOriginalName(); $path = public_path('img/products/' . $filename); //file name pada windwos tidak boleh menggunakan ':' di tutorial pake ':', alamat ditambahkan public_path Image::make($image->getRealPath())->resize(468, 249)->save($path); $product->image = 'img/products/' . $filename; $product->save(); return Redirect::to('admin/products/index')->with('message', 'Product Created'); } return Redirect::to('admin/products/index')->with('message', 'Something went wrong')->withErrors($validator)->withInput(); }