$post], function($message) use ($post) { $message->from('info@poonamirrigation.com', 'Poonam Irrigation'); $message->to($post['email'])->subject($post['subject']); if(isset($post['attachment']) && $post['attachment']){ $message->attach($post['attachment']); } }); return ['status' => 1, 'message' => "Email sent successfully."]; } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function checkCategory($catId) { try{ $catData = Category::where("id",$catId)->first(); if($catData){ return $catData->c_name; } else{ return ""; } } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function checkPrdImage($catId) { try{ $catData = ProductImage::where("product_id",$catId)->first(); if($catData){ return $catData->image; } else{ return ""; } } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function checkProduct($id) { try{ $data = Product::where("id",$id)->first(); if($data){ return $data->pro_name; } else{ return ""; } } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function checktotalProduct($id) { try{ $data = Product::where("category_id",$id)->count(); if($data > 0){ return $data; } else{ return 0; } } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function totalInquiry($id) { try{ $data = Inquiry::where("p_id",$id)->count(); if($data > 0){ return $data; } else{ return 0; } } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function getWebSetting($keyData) { try{ $webData = WebSettings::where("web_key",$keyData)->first(); if($webData){ return $webData->web_value; } else{ return ""; } } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function getCountryName($coutryId) { try{ $user = Country::where("id",$coutryId)->first(); if($user){ return $user->name; } else{ return ""; } } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function getStateName($stateId) { try{ $stateData = State::where("id",$stateId)->first(); if($stateData){ return $stateData->name; } else{ return ""; } } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function getCityName($cityId) { try{ $cityData = City::where("id",$cityId)->first(); if($cityData){ return $cityData->name; } else{ return ""; } } catch (\Exception $e) { return ['status' => 0, 'message' => $e->getMessage()]; } } public static function ImageResize($finalWidth,$newHeight,$image,$destinationPath,$unlinkImagePath = null,$index = 0){ $imageMainPath = 'uploads/'.$destinationPath; $imageThumbPath = '/uploads/'.$destinationPath.'/thumbnail/'; if (!is_dir(public_path($imageMainPath))) { mkdir(public_path($imageMainPath)); } if (!is_dir(public_path($imageThumbPath))) { mkdir(public_path($imageThumbPath)); } if($unlinkImagePath){ $filename = public_path($imageMainPath.'/'.$unlinkImagePath); if(file_exists($filename)){ unlink($filename); } $filenameThumb = public_path($imageThumbPath.$unlinkImagePath); if(file_exists($filenameThumb)){ unlink($filenameThumb); } } list($width, $height) = getimagesize($image); //$newHeight = floor($height * ($finalWidth / $width)); $imageName = time().'Poonam'.$index.'.'.$image->getClientOriginalExtension(); $destinationPath = public_path($imageMainPath); $image_resize = Image::make($image->getRealPath()); $image->move($destinationPath,$imageName); $image_resize->resize($finalWidth,$newHeight,function($constraint) { $constraint->upsize(); }); $image_resize->save(public_path($imageThumbPath.$imageName)); return $imageName; } }