validate([ // The server should make sure to serve SVG files with the correct CSP to prevent XSS 'image' => 'required|image|mimes:jpg,png,jpeg,gif,svg,webp|max:5000', ]); /* Once the image is validated , create the name on the image */ $image = new Image(); $image->uuid = Str::uuid(); $image->path = $request->file('image')->store("uploads"); $image->save(); } /** * Remove the specified resource from storage. * * @param \App\Models\Image $image * @return \Illuminate\Http\Response */ public function destroy(Image $image) { $image->delete(); return back(); } }