/** * Deletes the specified guide step image. * * @param int|string $id * @param int|string $stepId * @param int|string $fileUuid * * @return \Illuminate\Http\RedirectResponse */ public function destroy($id, $stepId, $fileUuid) { $this->authorize('guides.steps.images.destroy'); $guide = $this->guide->locate($id); $step = $guide->findStep($stepId); $file = $step->findFile($fileUuid); if ($file->delete()) { flash()->success('Success!', 'Successfully deleted image.'); return redirect()->back(); } flash()->error('Error!', 'There was an issue deleting this image. Please try again.'); return redirect()->back(); }
/** * Deletes the specified guide. * * @param int|string $id * * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { $guide = $this->guide->locate($id); $this->authorize('manage.guides'); if ($guide->delete()) { flash()->success('Success!', 'Successfully deleted guide!'); return redirect()->route('resources.guides.index'); } flash()->error('Error!', 'There was an issue deleting this guide. Please try again.'); return redirect()->route('resources.guides.show', [$id]); }
/** * Creates steps for the specified guide per image. * * @param GuideStepImagesRequest $request * @param int|string $id * * @return \Illuminate\Http\RedirectResponse */ public function upload(GuideStepImagesRequest $request, $id) { $guide = $this->guide->locate($id); $step = $guide->steps()->getRelated(); $uploaded = $this->dispatch(new Upload($request, $guide, $step)); if ($uploaded > 0) { flash()->success('Success!', "Successfully uploaded: {$uploaded} images."); return redirect()->route('resources.guides.show', [$id]); } flash()->error('Error!', 'There was an issue uploading images. Please try again.'); return redirect()->route('resources.guides.images', [$id]); }