cloudinary-laravel
cloudinary-laravel copied to clipboard
message : "Call to undefined method CloudinaryLabs\\CloudinaryLaravel\\CloudinaryEngine::getSecureUrl()"
A new issue I have been facing..
public function addProduct(Request $request)
{ // Validate the request inputs $validatedData = $request->validate([ 'name' => 'required|string|max:255', 'type' => 'required|string|max:255', 'price' => 'required|numeric', 'description' => 'required|string', 'file' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:10048' ]);
// Store the image on Cloudinary
$uploadedFileUrl = Cloudinary::upload($request->file('file')->getRealPath(), [
'folder' => 'product'
]);
// Get the secure URL of the uploaded image
$secureUrl = $uploadedFileUrl->getSecureUrl();
// Create a new Product instance
$product = new Product;
$product->name = $request->input('name');
$product->type = $request->input('type');
$product->price = $request->input('price');
$product->description = $request->input('description');
$product->img_path = $secureUrl;
$product->save();
return response()->json($product, 201);
}