/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     EmailEvent::truncate();
     EmailQueue::truncate();
     $this->repository->create(['code' => 'user_request_password', 'name' => 'Запрос на восстановление пароля', 'fields' => ['code' => 'Код восстановления пароля', 'username' => 'Имя пользователя', 'email' => 'Email пользователя', 'reflink' => 'Ссылка для восстановления пароля']]);
     $this->repository->create(['code' => 'user_new_password', 'name' => 'Новый пароль', 'fields' => ['password' => 'Новый пароль', 'email' => 'Email пользователя', 'username' => 'Имя пользователя']]);
 }
 /**
  * @param EmailEventRepository $repository
  */
 public function getOptions(EmailEventRepository $repository)
 {
     $uid = $this->getRequiredParameter('uid', 'required|numeric');
     $emailEvent = $repository->findOrFail($uid);
     $options = array_merge($emailEvent->fields, config('email.default_template_data'));
     $this->setContent($options);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     EmailTemplate::truncate();
     $emailEvent = $this->emailEventRepository->query()->whereCode('user_request_password')->first();
     $this->emailTemplateRepository->create(['status' => 1, 'email_event_id' => $emailEvent->id, 'email_from' => '{default_email}', 'email_to' => '{email}', 'subject' => '{site_title}: Ссылка для восстановления пароля', 'message' => '<h3>Здраствуйте {username}!</h3>Чтобы восстановить &nbsp;пароль от своего аккаунта, пройдите, пожалуйста, по ссылке:  <a href="{reflink}">{reflink}</a>&nbsp;или введите код&nbsp;<b>{code}</b> вручную на странице восстановления.<p>----------------------------------------</p><p>Данное письмо сгенерировано автоматически, отвечать на него не нужно.<span style="line-height: 1.45em;"></span></p>', 'message_type' => 'html']);
     $emailEvent2 = $this->emailEventRepository->query()->whereCode('user_new_password')->first();
     $this->emailTemplateRepository->create(['status' => 1, 'email_event_id' => $emailEvent2->id, 'email_from' => '{email_from}', 'email_to' => '{email}', 'subject' => '{site_title}: Новый пароль от вашего аккаунта', 'message' => '<h3>Здраствуйте {username}!</h3>Ваш новый пароль:&nbsp;<b>{password}</b><p></p><p>Всегда храните свой пароль в тайне и&nbsp;не сообщайте его никому.<br></p><p>----------------------------------------</p><p><p>Данное письмо сгенерировано автоматически, отвечать на него не нужно.</p></p><p></p>', 'message_type' => 'html']);
 }
 /**
  * @param EmailTemplateRepository $repository
  * @param EmailEventRepository    $emailEventRepository
  * @param int                 $id
  */
 public function getEdit(EmailTemplateRepository $repository, EmailEventRepository $emailEventRepository, $id)
 {
     WYSIWYG::loadDefaultEditors();
     $emailTemplate = $repository->findOrFail($id);
     $this->setTitle(trans('email::core.title.templates.edit', ['title' => $emailTemplate->subject]));
     $action = 'backend.email.template.edit.post';
     $emailEvents = $emailEventRepository->eventsList();
     $this->setContent('email.template.form', compact('emailTemplate', 'action', 'emailEvents'));
 }
 /**
  * @param EmailEventRepository $repository
  * @param int              $id
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws \Exception
  */
 public function postDelete(EmailEventRepository $repository, $id)
 {
     $emailEvent = $repository->delete($id);
     return $this->smartRedirect()->with('success', trans('email::core.messages.events.deleted', ['title' => $emailEvent->name]));
 }