1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace App\Repositories;
- use App\Models\EmailTemplate;
- use Prettus\Repository\Eloquent\BaseRepository;
- use Prettus\Repository\Criteria\RequestCriteria;
- class EmailTemplateRepository extends BaseRepository
- {
-
- public function model()
- {
- return EmailTemplate::class;
- }
-
-
- public function boot()
- {
- $this->pushCriteria(app(RequestCriteria::class));
- }
-
- public function getTemplate(string $alias, array $titleParams = [], array $contentParams = [])
- {
- $template=$this->model->where('alias', $alias)->first();
- if (!empty($titleParams)) {
- $template->title=render_template($template->title, $titleParams);
- }
- if (!empty($contentParams)) {
- $template->value=render_template($template->value, $contentParams);
- }
- return $template;
- }
-
- }
|