Add email templates, page layouts, and shop themes (template system)
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s
- E-Mail-Templates: DB-gespeicherte HTML-Templates mit {{placeholder}}-System,
Admin-UI zum Bearbeiten von Betreff und Body, alle 4 Mailables aktualisiert
- Seiten-Layouts: 4 Layouts für CMS-Seiten (Standard, Sidebar, Volle Breite, Landing),
Layout-Auswahl im Admin-Formular
- Shop-Themes: 5 Farbthemen via CSS-Variablen, Picker in Einstellungen
- Deployment: EmailTemplateSeeder wird automatisch beim Deploy ausgeführt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EmailTemplate extends Model
|
||||
{
|
||||
protected $fillable = ['key', 'label', 'subject', 'body', 'variables'];
|
||||
protected $casts = ['variables' => 'array'];
|
||||
|
||||
public static function getByKey(string $key): ?self
|
||||
{
|
||||
return static::where('key', $key)->first();
|
||||
}
|
||||
|
||||
public function renderBody(array $data): string
|
||||
{
|
||||
$body = $this->body;
|
||||
foreach ($data as $k => $v) {
|
||||
$body = str_replace('{{' . $k . '}}', (string) $v, $body);
|
||||
}
|
||||
return $body;
|
||||
}
|
||||
|
||||
public function renderSubject(array $data): string
|
||||
{
|
||||
$subject = $this->subject;
|
||||
foreach ($data as $k => $v) {
|
||||
$subject = str_replace('{{' . $k . '}}', (string) $v, $subject);
|
||||
}
|
||||
return $subject;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Page extends Model
|
||||
{
|
||||
protected $fillable = ['slug','title','content','type','image','meta_title','meta_description','published','published_at','show_in_footer','show_in_nav','nav_sort'];
|
||||
protected $fillable = ['slug','title','content','type','image','meta_title','meta_description','published','published_at','show_in_footer','show_in_nav','nav_sort','layout'];
|
||||
|
||||
protected $casts = ['published' => 'boolean', 'published_at' => 'datetime', 'show_in_footer' => 'boolean', 'show_in_nav' => 'boolean'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user