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>
58 lines
2.0 KiB
PHP
58 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Setting;
|
|
use Illuminate\Http\Request;
|
|
|
|
class SettingsController extends Controller
|
|
{
|
|
private array $keys = [
|
|
'shop_name','shop_email','shop_phone','shop_address','shop_owner','shop_vat_id',
|
|
'bank_name','bank_iban','bank_bic','invoice_payment_days',
|
|
'smtp_host','smtp_port','smtp_user','smtp_password','smtp_from_name','smtp_from_email',
|
|
'cookie_consent','google_analytics','require_customer_approval',
|
|
'theme_name',
|
|
];
|
|
|
|
public function index()
|
|
{
|
|
$settings = [];
|
|
foreach ($this->keys as $key) {
|
|
$settings[$key] = Setting::get($key, '');
|
|
}
|
|
$settings['shop_logo'] = Setting::get('shop_logo', '');
|
|
return view('admin.settings.index', compact('settings'));
|
|
}
|
|
|
|
public function update(Request $request)
|
|
{
|
|
foreach ($this->keys as $key) {
|
|
Setting::set($key, $request->input($key, ''));
|
|
}
|
|
|
|
// Logo hochladen
|
|
if ($request->hasFile('shop_logo')) {
|
|
$path = $request->file('shop_logo')->store('branding', 'public');
|
|
Setting::set('shop_logo', $path);
|
|
}
|
|
// Logo löschen
|
|
if ($request->boolean('delete_logo')) {
|
|
Setting::set('shop_logo', '');
|
|
}
|
|
|
|
// SMTP live in .env-Werte schreiben (für aktuellen Request anwenden)
|
|
config([
|
|
'mail.mailers.smtp.host' => Setting::get('smtp_host'),
|
|
'mail.mailers.smtp.port' => Setting::get('smtp_port'),
|
|
'mail.mailers.smtp.username' => Setting::get('smtp_user'),
|
|
'mail.mailers.smtp.password' => Setting::get('smtp_password'),
|
|
'mail.from.address' => Setting::get('smtp_from_email'),
|
|
'mail.from.name' => Setting::get('smtp_from_name'),
|
|
]);
|
|
|
|
return back()->with('success', 'Einstellungen gespeichert.');
|
|
}
|
|
}
|