feat: add webshop offline maintenance mode with admin toggle and red maintenance screen

This commit is contained in:
2026-11-01 16:28:30 +01:00
parent 4994d4a8ef
commit b3add6f0c2
10 changed files with 419 additions and 1 deletions
@@ -85,6 +85,10 @@ class ContentController extends Controller
'footer_shipping_text',
'footer_copyright',
'footer_payment_text',
// Offline / Maintenance Mode
'shop_offline_title',
'shop_offline_message',
];
// Handle checkbox toggles that aren't present if unchecked
@@ -92,6 +96,10 @@ class ContentController extends Controller
Setting::set('announcement_enabled', '0');
}
if ($request->has('shop_offline_submitted')) {
Setting::set('shop_offline', $request->boolean('shop_offline') ? '1' : '0');
}
foreach ($fields as $field) {
if ($request->has($field)) {
$value = $request->input($field);
@@ -168,4 +176,20 @@ class ContentController extends Controller
->with('error', "Fout bij verzenden van e-mail via {$defaultMailer}: ".$e->getMessage());
}
}
/**
* Toggle the webshop offline / online status.
*/
public function toggleOffline(Request $request): RedirectResponse
{
$current = Setting::get('shop_offline', '0') === '1';
$new = ! $current;
Setting::set('shop_offline', $new ? '1' : '0');
Setting::flushCache();
$statusText = $new ? 'OFFLINE gezet' : 'weer ONLINE gezet';
return redirect()->back()
->with('success', "De webshop is direct {$statusText}!");
}
}