/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::all(); $validation = Validator::make($input, Slideshow::$rules); if ($validation->passes()) { if (Input::hasFile('image')) { foreach (Input::file('image') as $image) { $imagename = time() . $image->getClientOriginalName(); $upload_path = 'uploads/images/'; //make thumbnail for each image Image::make($image->getRealPath())->resize(100, null, true, false)->save($upload_path . 'thumbs/' . $imagename); $image->move($upload_path, $imagename); $input['image'] = $imagename; $this->slideshow->create($input); } } else { $input['image'] = ''; } return Redirect::route('slideshows.index'); } return Redirect::route('slideshows.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.'); }