Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Malebestia committed Sep 4, 2023
1 parent e8a9cc4 commit f842a05
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 68 deletions.
61 changes: 61 additions & 0 deletions Actions/BuildMailMessageAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}
}
68 changes: 0 additions & 68 deletions Actions/BuildUserMailMessageAction.php

This file was deleted.

0 comments on commit f842a05

Please sign in to comment.