From: Louis Jeckel Date: Tue, 17 Nov 2020 16:53:47 +0000 (+0100) Subject: cleanup X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8c922be02753084d6766e417c8db8e214e04884e;p=psq.git cleanup --- diff --git a/app/EmailTemplate.php b/app/EmailTemplate.php index 78b238a..b010717 100644 --- a/app/EmailTemplate.php +++ b/app/EmailTemplate.php @@ -44,12 +44,10 @@ class EmailTemplate extends Model * @param $user * @param $content * @return string - * @todo remove first regex */ public static function fillWithContentFor($user, $content) { $content = self::fillWithRegex($user, $content, '/\{\{[^(% )]*\}\}/', '{{', '}}'); - $content = self::fillWithRegex($user, $content, '/%[^(% )]*%/', '%', '%'); return self::processLinks($user, $content); } @@ -87,7 +85,7 @@ class EmailTemplate extends Model */ public function fillFor(User $user) { - return self::fillWithContentFor($user, $this->content); + return self::fillWithContentFor($user, $this->html); } /** @@ -99,22 +97,6 @@ class EmailTemplate extends Model return self::fillWithContentFor($user, $this->subject); } - /** - * @param $url - * @param $label - * @param null $color - * @return string - * @throws \Throwable - * @todo remove - * @deprecated - */ - public static function button($url, $label, $color = null) - { - return view('unlayer.button', [ - 'url' => $url, - 'slot' => $label, - ])->render(); - } /** * @param Builder $builder @@ -140,9 +122,7 @@ class EmailTemplate extends Model */ public function getMailableFor(User $user) { - return $this->html ? - (new TemplateMail($this->fillFor($user), $this->fillSubjectFor($user))) : - (new TemplateMailOld($this->fillFor($user), $this->fillSubjectFor($user))); + return new TemplateMail($this->fillFor($user), $this->fillSubjectFor($user)); } /** @@ -154,9 +134,13 @@ class EmailTemplate extends Model return $this->render(); } + /** + * @return mixed + * @deprecated + */ public function getContentAttribute() { - return $this->html ?? $this->getAttributes()['content']; + return $this->html; } diff --git a/app/TemplateVariables.php b/app/TemplateVariables.php index 4689b70..9addcfd 100644 --- a/app/TemplateVariables.php +++ b/app/TemplateVariables.php @@ -128,68 +128,6 @@ trait TemplateVariables - /** - * @return string - * @throws \Throwable - */ - public function getHomeButtonTemplate() - { - return EmailTemplate::button(url('/'), 'Cliquez ici'); - } - - /** - * @return string - * @throws \Throwable - */ - public function getMyAccountButtonTemplate() - { - return EmailTemplate::button( - $this->routeWithToken('account.index', [], now()->addDays(7)), - 'Accéder à mon compte' - ); - } - - - /** - * @return string - * @throws \Throwable - */ - public function getCompleteRegistrationButtonTemplate() - { - return EmailTemplate::button( - $this->routeWithToken('account.complete-reg', [], now()->addDays(7)), - 'Créer mon mot de passe' - ); - - } - - - /** - * @return string - * @throws \Throwable - */ - public function getContactButtonTemplate() - { - return EmailTemplate::button( - route('contact.index'), - 'Nous contacter' - ); - - } - - /** - * @return string - * @throws \Throwable - */ - public function getAskPdfButtonTemplate() - { - $route = \URL::signedRoute('account.ask-pdf', ['user' => $this->id]); - return EmailTemplate::button( - $route, - 'Reçevoir le PDF' - ); - } - /** * @return string diff --git a/resources/views/unlayer/button.blade.php b/resources/views/unlayer/button.blade.php deleted file mode 100644 index b628832..0000000 --- a/resources/views/unlayer/button.blade.php +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -