mailLocale = $user->lang_preference ?: config('app.fallback_locale'); $translations = $poll->post?->translations ?? collect(); $this->pollTitle = ($translations->firstWhere('locale', $this->mailLocale) ?? $translations->first())?->title ?? ''; // The verification page is added in a later step $this->verifyUrl = Route::has('polls.verify') ? route('polls.verify', $poll) : null; } public function build() { app()->setLocale($this->mailLocale); return $this ->from(timebank_config('mail.support.email'), timebank_config('mail.support.name')) ->subject(__('Your poll receipt')) ->view('emails.polls.receipt'); } }