/** * Update the specified StickerStore in storage. * PUT/PATCH /stickerStores/{id} * * @param int $id * @param Request $request * * @return Response */ public function update($id, Request $request) { $input = $request->all(); /** @var StickerStore $stickerStore */ $stickerStore = $this->stickerStoreRepository->apiFindOrFail($id); $result = $this->stickerStoreRepository->updateRich($input, $id); $stickerStore = $stickerStore->fresh(); return $this->sendResponse($stickerStore->toArray(), "StickerStore updated successfully"); }
/** * Update the specified StickerStore in storage. * * @param int $id * @param UpdateStickerStoreRequest $request * * @return Response */ public function update($id, UpdateStickerStoreRequest $request) { $stickerStore = $this->stickerStoreRepository->find($id); if (empty($stickerStore)) { Flash::error('StickerStore not found'); return redirect(route('stickerStores.index')); } $input = $request->all(); if ($request->file('stickerImg')) { $uploadImage = $this->uploadImage($request->file('stickerImg'), '/stickers_photo/'); $input['stickerImg'] = $uploadImage['resize_url'][0]; } $this->stickerStoreRepository->updateRich($input, $id); Flash::success('StickerStore updated successfully.'); return redirect(route('stickerStores.index')); }