1$allowedMimeTypes = ['image/jpeg','image/gif','image/png'];
2$contentType = $request->file->getClientMimeType();
3
4if(! in_array($contentType, $allowedMimeTypes) ){
5 return response()->json('error: Not an image');
6}else{
7 return $this->productService->storeImage($request->file);
8}