-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Malebestia
committed
Sep 4, 2023
1 parent
e8a9cc4
commit f842a05
Showing
2 changed files
with
61 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
<<<<<<< HEAD | ||
use Modules\Notify\Datas\AttachmentData; | ||
use Spatie\LaravelData\DataCollection; | ||
use Spatie\QueueableAction\QueueableAction; | ||
|
@@ -42,5 +43,65 @@ public function execute( | |
} | ||
|
||
return $email; | ||
======= | ||
use Illuminate\Support\Str; | ||
use Modules\Notify\Models\NotifyTheme; | ||
use Spatie\QueueableAction\QueueableAction; | ||
|
||
class BuildMailMessageAction { | ||
use QueueableAction; | ||
|
||
public function execute(string $name, Model $model, array $view_params): MailMessage { | ||
$view_params = array_merge($view_params, $model->toArray()); | ||
$type='email'; | ||
$theme = NotifyTheme::firstOrCreate([ | ||
'lang' => $view_params['lang'] ?? app()->getLocale(), | ||
'type' => $type, // email,sms,whatsapp,piccione | ||
'post_type' => $name, | ||
'post_id' => $view_params['post_id'] ?? 0, | ||
]); | ||
|
||
|
||
|
||
|
||
if (null == $theme->subject) { | ||
$subject = trans('lu::auth.'.$name.'.subject'); | ||
$theme->update(['subject' => $subject]); | ||
} | ||
if (null == $theme->theme) { | ||
$theme->update(['theme' => 'ark']); | ||
} | ||
if (null == $theme->body_html) { | ||
$html = trans('lu::auth.'.$name.'.body_html'); | ||
|
||
if ('verify-email' == $name && 3 == $view_params['post_id']) { | ||
$html .= '<br/>When you\'ll re-login this will be your password: ##password##'; | ||
} | ||
|
||
$theme->update(['body_html' => $html]); | ||
} | ||
$view_params = array_merge($view_params, $theme->toArray()); | ||
// $this->view_params['url'] = (string)$url; | ||
|
||
$body_html = $theme->body_html; | ||
foreach ($view_params as $k => $v) { | ||
if (is_string($v)) { | ||
$body_html = Str::replace('##'.$k.'##', $v, $body_html); | ||
} | ||
} | ||
|
||
$view_params['body_html'] = $body_html; | ||
|
||
$view_html = 'lu::auth.emails.html'; | ||
|
||
// $out = view($view_html, $this->view_params); | ||
// dddx($this->view_params); | ||
// die($out->render()); | ||
|
||
return (new MailMessage()) | ||
// ->from('[email protected]', 'Barrett Blair') | ||
->subject($theme->subject) | ||
->view($view_html, $view_params); | ||
>>>>>>> 5da1f59 (up) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.