tagId = $tagId; $this->locale = $locale ?? App::getLocale(); } /** * Build the message. * * @return $this */ public function build() { // Set application locale for this email app()->setLocale($this->locale); $tagInfo = collect((new Tag())->translateTagIdsWithContexts($this->tagId, $this->locale, App::getFallbackLocale())); // Handle empty tag info $tagInfoData = $tagInfo->first(); $tagName = $tagInfoData['tag'] ?? 'Unknown Tag'; return $this ->from(timebank_config('mail.system_admin.email'), timebank_config('mail.system_admin.name')) ->subject(trans('messages.new_tag_added', [], $this->locale) . ': ' . $tagName) ->view('emails.tags.new') ->with(['tagInfo' => $tagInfoData ]); } }