diff --git a/.env.example b/.env.example index a1c1939..628b7af 100644 --- a/.env.example +++ b/.env.example @@ -31,6 +31,7 @@ MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_NAME="${APP_NAME}" MAIL_CONTACTFORM_RECEIVER= +MAIL_CONTACTFORM_CUSTOMER_SERVICE_RECEIVER= # Sentry SENTRY_LARAVEL_DSN= @@ -44,5 +45,5 @@ GOOGLE_RECAPTCHA_PUBLIC= GOOGLE_RECAPTCHA_PRIVATE= GOOGLE_RECAPTCHA_VERSION= -# Admin secure -LDC_WEB_API_KEY= \ No newline at end of file +# Admin secure +LDC_WEB_API_KEY= diff --git a/app/Http/Controllers/Fo/StaticPageController.php b/app/Http/Controllers/Fo/StaticPageController.php index 25de555..223ac24 100644 --- a/app/Http/Controllers/Fo/StaticPageController.php +++ b/app/Http/Controllers/Fo/StaticPageController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Fo; +use App\Enums\Contact\ObjectEnum; use App\Enums\StaticPageType; use App\Http\Controllers\Controller; use App\Http\Requests\Fo\ContactRequest; @@ -103,14 +104,19 @@ class StaticPageController extends Controller } /** - * Display a listing of the resource. + * Handle contactForm Request * * @param \App\Http\Requests\Fo\ContactRequest $request * @return \Illuminate\Http\RedirectResponse */ public function contactForm(ContactRequest $request): \Illuminate\Http\RedirectResponse { - $receivers = \config('mail.contactform.receiver'); + if ($request->object === strval(ObjectEnum::customerService->value())) { + $receivers = \config('mail.contactform.customerService'); + } else { + $receivers = \config('mail.contactform.receiver'); + } + foreach ($receivers as $email) { Mail::to($email)->send(new SendContactMail((object)$request->validated())); } @@ -180,7 +186,7 @@ class StaticPageController extends Controller } /** - * Display a listing of the resource. + * Handle joinusForm Request * * @param \App\Http\Requests\Fo\JoinusRequest $request * @return \Illuminate\Http\RedirectResponse diff --git a/config/mail.php b/config/mail.php index 555c3db..c4455e1 100644 --- a/config/mail.php +++ b/config/mail.php @@ -97,7 +97,8 @@ return [ ], 'contactform' => [ - 'receiver' => explode(',', env('MAIL_CONTACTFORM_RECEIVER', 'hello@example.com')) + 'receiver' => explode(',', env('MAIL_CONTACTFORM_RECEIVER', 'hello@example.com')), + 'customerService' => explode(',', env('MAIL_CONTACTFORM_CUSTOMER_SERVICE_RECEIVER')) ], /* diff --git a/manifest.yaml b/manifest.yaml index bc68f89..73ef469 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -1,4 +1,3 @@ ---- apiVersion: v1 kind: ConfigMap metadata: @@ -22,6 +21,7 @@ data: MAIL_FROM_ADDRESS: "${APP_MAIL_FROM_ADDRESS}" MAIL_FROM_NAME: "${APP_APP_NAME}" MAIL_CONTACTFORM_RECEIVER: "${APP_MAIL_CONTACTFORM_RECEIVER}" + MAIL_CONTACTFORM_CUSTOMER_SERVICE_RECEIVER: "${APP_MAIL_CONTACTFORM_CUSTOMER_SERVICE_RECEIVER}" LDC_WEB_API_KEY: "${APP_LDC_WEB_API_KEY}" GOOGLE_RECAPTCHA_PRIVATE: "${APP_GOOGLE_RECAPTCHA_PRIVATE}" GOOGLE_RECAPTCHA_PUBLIC: "${APP_GOOGLE_RECAPTCHA_PUBLIC}" @@ -37,7 +37,7 @@ metadata: spec: storageClassName: "csi-cinder-classic" accessModes: - - ReadWriteOnce + - ReadWriteOnce resources: requests: storage: $APP_PVC_SIZE @@ -58,25 +58,25 @@ spec: app: ${CI_PROJECT_PATH_SLUG}-app spec: containers: - - name: ${CI_PROJECT_PATH_SLUG}-container - image: $IMAGE_TAG - envFrom: - - configMapRef: - name: ${CI_PROJECT_PATH_SLUG}-config-map - volumeMounts: - - name: storage - mountPath: /app/srcs/storage + - name: ${CI_PROJECT_PATH_SLUG}-container + image: $IMAGE_TAG + envFrom: + - configMapRef: + name: ${CI_PROJECT_PATH_SLUG}-config-map + volumeMounts: + - name: storage + mountPath: /app/srcs/storage imagePullSecrets: - - name: docker-registry-credentials + - name: docker-registry-credentials securityContext: runAsUser: 33 runAsGroup: 33 fsGroup: 33 fsGroupChangePolicy: "OnRootMismatch" volumes: - - name: storage - persistentVolumeClaim: - claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage + - name: storage + persistentVolumeClaim: + claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage --- apiVersion: v1 @@ -87,8 +87,8 @@ spec: selector: app: ${CI_PROJECT_PATH_SLUG}-app ports: - - port: 80 - targetPort: 443 + - port: 80 + targetPort: 443 --- apiVersion: traefik.io/v1alpha1 @@ -97,16 +97,16 @@ metadata: name: ${CI_PROJECT_PATH_SLUG}-ingress-route spec: entryPoints: - - web - - websecure + - web + - websecure routes: - - match: Host(`${APP_DOMAIN}`) || Host(`www.${APP_DOMAIN}`) - kind: Rule - services: - - name: ${CI_PROJECT_PATH_SLUG}-service - port: 80 - middlewares: - - name: redirect-no-www-to-www + - match: Host(`${APP_DOMAIN}`) || Host(`www.${APP_DOMAIN}`) + kind: Rule + services: + - name: ${CI_PROJECT_PATH_SLUG}-service + port: 80 + middlewares: + - name: redirect-no-www-to-www tls: secretName: ${CRT_TLS_NAME} @@ -124,35 +124,35 @@ spec: affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - ${CI_PROJECT_PATH_SLUG}-app - topologyKey: "kubernetes.io/hostname" - namespaces: [$KUBE_NAMESPACE] + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - ${CI_PROJECT_PATH_SLUG}-app + topologyKey: "kubernetes.io/hostname" + namespaces: [$KUBE_NAMESPACE] containers: - - name: ${CI_PROJECT_PATH_SLUG}-scheduled - image: $IMAGE_TAG - imagePullPolicy: IfNotPresent - command: - - "php" - args: - - "artisan" - - "schedule:run" - envFrom: - - configMapRef: - name: ${CI_PROJECT_PATH_SLUG}-config-map - volumeMounts: - - name: storage - mountPath: /app/srcs/storage - imagePullSecrets: - - name: docker-registry-credentials - volumes: + - name: ${CI_PROJECT_PATH_SLUG}-scheduled + image: $IMAGE_TAG + imagePullPolicy: IfNotPresent + command: + - "php" + args: + - "artisan" + - "schedule:run" + envFrom: + - configMapRef: + name: ${CI_PROJECT_PATH_SLUG}-config-map + volumeMounts: - name: storage - persistentVolumeClaim: - claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage + mountPath: /app/srcs/storage + imagePullSecrets: + - name: docker-registry-credentials + volumes: + - name: storage + persistentVolumeClaim: + claimName: ${CI_PROJECT_PATH_SLUG}-pvc-storage securityContext: runAsUser: 33 runAsGroup: 33