profile = $profile; $this->bank = $bank; $this->amount = $amount; $this->originalTransactionId = $originalTransactionId; $this->description = $description; $this->locale = $profile->lang_preference ?? config('app.fallback_locale'); if (empty($this->locale)) { $this->locale = config('app.fallback_locale'); } $profileClass = get_class($profile); $transactionsPath = LaravelLocalization::getURLFromRouteNameTranslated($this->locale, 'routes.transactions'); $transactionsUrl = url($transactionsPath); if ($profileClass === 'App\\Models\\User') { $this->buttonUrl = LaravelLocalization::localizeURL( route('user.direct-login', ['userId' => $profile->id, 'intended' => $transactionsUrl, 'name' => $profile->name]), $this->locale ); } elseif ($profileClass === 'App\\Models\\Organization') { $this->buttonUrl = LaravelLocalization::localizeURL( route('organization.direct-login', ['organizationId' => $profile->id, 'intended' => $transactionsUrl]), $this->locale ); } else { $this->buttonUrl = LaravelLocalization::localizeURL(route('login'), $this->locale); } } public function build() { app()->setLocale($this->locale); $subject = trans('messages.reversal_issued_subject', [], $this->locale); return $this ->from(timebank_config('mail.support.email'), timebank_config('mail.support.name')) ->subject($subject) ->view('emails.reversal-issued.reversal-issued') ->with([ 'profile' => $this->profile, 'bank' => $this->bank, 'amountFormatted' => tbFormat($this->amount), 'originalTransactionId' => $this->originalTransactionId, 'description' => $this->description, 'buttonUrl' => $this->buttonUrl, ]); } }