dev update
This commit is contained in:
@@ -34,12 +34,18 @@ class EmailTemplateService
|
||||
return $this->renderer->render($this->loadTemplate($scenario), $data);
|
||||
}
|
||||
|
||||
public function loadTemplate(string $scenario): Template
|
||||
/**
|
||||
* Tìm template theo `key` (định danh riêng, ưu tiên) hoặc `scenario`
|
||||
* (tương thích ngược với các lời gọi cũ truyền scenario làm định danh).
|
||||
*/
|
||||
public function loadTemplate(string $key): Template
|
||||
{
|
||||
return Cache::remember(
|
||||
Template::CACHE_PREFIX . $scenario,
|
||||
Template::CACHE_PREFIX . $key,
|
||||
3600,
|
||||
fn () => Template::where('scenario', $scenario)->where('status', 1)->firstOrFail(),
|
||||
fn () => Template::where('status', 1)
|
||||
->where(fn ($q) => $q->where('key', $key)->orWhere('scenario', $key))
|
||||
->firstOrFail(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user