/** * Store a newly created resource in storage. * * @return Response */ public function store() { $product = new Product(array_merge(Input::only(['name', 'description', 'price', 'vat']), ['active' => Input::has('active'), 'temp_price' => Input::has('temp_price') ? Input::get('temp_price') : null])); if (!$product->save()) { return Redirect::back()->withInput()->withErrors($product->errors); } $product->terms()->sync([Input::get('department'), Input::get('category'), Input::get('brand')]); $this->_uploadImages($product); $this->_syncProductStock($product); return Redirect::route('admin.products.index')->with('success', 'Het product is succesvol toegevoegd.'); }