data = $data; $this->type = $type; } /** * Build the message. * * @return $this */ public function build() { $mail_template_file = 'mail.payment-success'; if ($this->type == 'event'){ $mail_template_file = 'mail.event-payment-success'; }elseif($this->type == 'donation'){ $mail_template_file = 'mail.donation-payment-success'; } return $this->from(get_static_option('site_global_email'), get_static_option('site_'.get_default_language().'_title')) ->subject('Payment Success for '.get_static_option('site_'.get_default_language().'_title')) ->view($mail_template_file); } }