Skip to content

Commit

Permalink
update to use TokenHelper Facade
Browse files Browse the repository at this point in the history
  • Loading branch information
cannycookie committed May 13, 2024
1 parent a2df9ea commit b3d1a0a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Models/EmailTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Str;
use Visualbuilder\EmailTemplates\Database\Factories\EmailTemplateFactory;
use Visualbuilder\EmailTemplates\Traits\TokenHelper;
use Visualbuilder\EmailTemplates\Facades\TokenHelper;


/**
* @property int $id
Expand Down Expand Up @@ -161,7 +162,7 @@ public function getEmailPreviewData()
$models = self::createEmailPreviewData();

return [
'user' => $model->user,
'user' => $models->user,
'content' => TokenHelper::replace($this->content, $models),
'subject' => TokenHelper::replace($this->subject, $models),
'preHeaderText' => TokenHelper::replace($this->preheader, $models),
Expand All @@ -180,7 +181,7 @@ public static function createEmailPreviewData()

$userModel = config('filament-email-templates.recipients')[0];
//Setup some data for previewing email template
$model->user = $userModel::first();
$models->user = $userModel::first();

$models->tokenUrl = URL::to('/');
$models->verificationUrl = URL::to('/');
Expand All @@ -205,8 +206,8 @@ public function scopeLanguage(Builder $query, $language)

return $query->whereIn('language', $languages)
->orderByRaw(
"(CASE WHEN language = ? THEN 1 ELSE 2 END)",
[$language]
"(CASE WHEN language = ? THEN 1 ELSE 2 END)",
[$language]
);
}

Expand All @@ -216,7 +217,7 @@ public function scopeLanguage(Builder $query, $language)
public function viewPath(): Attribute
{
return new Attribute(
get: fn () => config('filament-email-templates.template_view_path').'.'.$this->view
get: fn () => config('filament-email-templates.template_view_path').'.'.$this->view
);
}

Expand Down

0 comments on commit b3d1a0a

Please sign in to comment.