where('published', true)->orderBy('order', 'ASC')->get(); $approachSlideModels = ApproachSlide::query()->where('published', true)->orderBy('order', 'ASC')->get(); return view('fo.pages.home', compact('mainSlideModels', 'approachSlideModels')); } /** * Call the CRM to add a single optin * * @param \App\Http\Requests\Fo\SingleOptinRequest $request * @return string|array|null|\Illuminate\Contracts\Translation\Translator * @throws \LDC\LDCCRM\Exceptions\ValidationException ValidationException. * @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException. */ public function addOptIn(SingleOptinRequest $request) { try { SingleOptin::setStatus($request->email, true); return \response(trans("Votre inscription à la newsletter a été prise en compte"), 200); } catch (ApiErrorException $e) { // Il y a deja un customerInfo avec optin a true pour ce customer. if ($e->getApiError()->equals(ApiError::singleOptinCustomerExists())) { return trans('Vous êtes déjà inscrit avec cette adresse email'); } if (app()->bound('sentry')) { app('sentry')->captureException($e); } return \response(trans('Une erreur est survenue, merci de réessayer ultérieurement'), 404); } catch (CrmException $e) { if (app()->bound('sentry')) { app('sentry')->captureException($e); } return \response(trans('Une erreur est survenue, merci de réessayer ultérieurement'), 404); } } }