41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\SystemSettings;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\System\MaintenanceManagementService;
|
|
use App\Services\SystemConfig\SystemConfigService;
|
|
use Illuminate\Http\Request;
|
|
|
|
class MaintenanceModeController extends Controller
|
|
{
|
|
public function __construct(
|
|
protected SystemConfigService $systemConfig,
|
|
protected MaintenanceManagementService $maintenanceService
|
|
) {
|
|
// Middleware handled in web.php
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
return view('pages.system_settings.maintenance-mode', [
|
|
'settings' => $this->systemConfig->all(),
|
|
'is_down' => $this->maintenanceService->isDown(),
|
|
]);
|
|
}
|
|
|
|
public function broadcast(Request $request)
|
|
{
|
|
$validated = $request->validate([
|
|
'minutes' => ['required', 'integer', 'min:1', 'max:60'],
|
|
]);
|
|
|
|
$this->maintenanceService->broadcastWarning($validated['minutes']);
|
|
|
|
return response()->json([
|
|
'success' => true,
|
|
'message' => __('Broadcast warning sent to all active users.'),
|
|
]);
|
|
}
|
|
}
|