Auto Disable

The auto-disable feature automatically deactivates maintenance mode when the timer reaches zero.

Implementation

// Timer initialization
php artisan curtain:up --timer="2 hours"

How it Works

Timer Setup

// CurtainService.php
protected function setTimer(string $duration): void
{
    $endTime = Carbon::now()->add($duration);
    Cache::put(self::CACHE_KEY, $endTime);
}

Auto Disable Process

// Frontend countdown.blade.php
async update() {
    if (distance < 0) {
        // Timer completed
        clearInterval(this.interval);
        
        try {
            // Call auto-disable endpoint
            const response = await fetch('/curtain/disable');
            if (response.ok) {
                window.location.reload();
            }
        } catch (error) {
            // Retry mechanism
            setTimeout(() => window.location.reload(), 5000);
        }
    }
}

Error Handling

  • Automatic retry on failure

  • Graceful degradation

  • User feedback during process

Last updated