/** * Update current game image files. * * @param Game $game * @param Request $request * @param StoreGameRomRequest $validationRequest * @return \Illuminate\Http\Response */ public function updateImages(Request $request, StoreGameImagesRequest $validationRequest, Game $game) { $input = array_except(Input::all(), '_method'); if ($request->input('deleteCover')) { // Delete current cover file $game->deleteCover(); Session::flash('message', 'Cover file deleted'); } elseif (Input::hasFile('cover') and Input::file('cover')->isValid()) { // Upload new Cover file $image = Image::make(Input::file('cover')->getRealPath()); $game->uploadCover($image); Session::flash('message', 'Cover uploaded'); } return redirect('/game'); }