Initial commit: WitShop Laravel Online-Shop
- Laravel 11, Blade, Alpine.js, Tailwind CSS - Produkt- & Kategorieverwaltung mit Varianten - Checkout (Vorkasse + Rechnung), Session-Warenkorb - Admin-Backend (Dashboard, Bestellungen, Kunden, CMS) - DSGVO-konform: Cookie-Consent, Impressum, Widerruf, AGB - PDF-Rechnung via dompdf, SMTP-Mailversand - Kundenverwaltung mit manueller Freischaltung Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?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',
|
||||
];
|
||||
|
||||
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.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user