# 🌐 Laravel Domain Rotator System

Sistem domain rotator yang terintegrasi dengan Laravel framework, dilengkapi dengan deteksi Internet Positif menggunakan Skiddle API.

## ✨ Fitur Utama

- **🔄 Auto-Rotation** - Otomatis ganti domain ketika terdeteksi terblokir
- **🛡️ Internet Positif Detection** - Deteksi blocking menggunakan Skiddle API
- **🔗 Shortlink Management** - Buat shortlink dengan domain custom
- **📊 Real-time Monitoring** - Monitoring status domain secara real-time
- **⚙️ Advanced Settings** - Konfigurasi interval, timeout, dan retry

## 🚀 Quick Start

### 1. Install Dependencies
```bash
composer install
```

### 2. Setup Environment
```bash
cp .env.example .env
php artisan key:generate
```

### 3. Setup Database
```bash
php artisan migrate
php artisan db:seed --class=DomainRotatorSeeder
```

### 4. Start Server
```bash
php artisan serve
```

### 5. Access Dashboard
```
http://localhost:8000/rotator
```

## 📁 Struktur Proyek

```
taxi/
├── app/
│   ├── Http/Controllers/
│   │   └── DomainRotatorController.php    # Main controller
│   ├── Models/
│   │   ├── Domain.php                     # Domain model
│   │   ├── Shortlink.php                  # Shortlink model
│   │   └── Click.php                      # Click tracking model
│   └── Services/
│       └── DomainRotatorService.php       # Core service dengan Skiddle API
├── database/
│   ├── migrations/                        # Database migrations
│   └── seeders/
│       └── DomainRotatorSeeder.php        # Default domains
├── resources/views/
│   └── domain-rotator/
│       └── index.blade.php                # Dashboard utama
├── routes/
│   ├── web.php                            # Web routes
│   └── api.php                            # API routes
└── public/                                # Public assets
```

## 🔧 API Endpoints

### Domain Management
- `GET /api/rotator/domains` - Get all domains
- `POST /api/rotator/domains` - Create new domain
- `POST /api/rotator/check-all` - Check all domains
- `POST /api/rotator/switch-domain` - Switch active domain

### Shortlink Management
- `GET /api/rotator/shortlinks` - Get all shortlinks
- `POST /api/rotator/shortlinks` - Create new shortlink

### Settings
- `GET /api/rotator/settings` - Get settings
- `POST /api/rotator/settings` - Update settings

## 🛡️ Internet Positif Detection

Sistem menggunakan **Skiddle API** (`https://check.skiddle.id/`) untuk deteksi blocking:

```php
// Check domain with Skiddle API
$response = Http::timeout(5)->get('https://check.skiddle.id/', [
    'domain' => $domainName,
    'json' => 'true'
]);

$data = $response->json();
$isBlocked = $data['blocked'] ?? false;
```

## 🎯 Penggunaan

### Dashboard Features
- **Overview Tab** - Statistik dan kontrol auto-rotation
- **Domain Status Tab** - Status semua domain dengan health check
- **Create Shortlink Tab** - Buat shortlink dengan domain custom
- **Link History Tab** - Riwayat dan manajemen shortlink
- **Settings Tab** - Konfigurasi sistem

### Auto-Rotation
```javascript
// Start auto-rotation
startAutoRotation();

// Set check interval (seconds)
updateCheckInterval(1); // Check every 1 second
```

### Custom Domain Shortlink
```javascript
// Create shortlink with custom domain
const shortlinkData = {
    original_url: 'https://example.com',
    title: 'My Link',
    custom_domain: 'gasbrand.buzz'
};
```

## 📊 Default Domains

Sistem sudah dilengkapi dengan 5 domain default:
1. `cahbagoesopisial.online` (Priority 1 - Active)
2. `bangunpagi.online` (Priority 2)
3. `malamfoyafoya.online` (Priority 3)
4. `gasbrand.buzz` (Priority 4)
5. `short.ly` (Priority 5)

## 🔧 Konfigurasi

### Environment Variables
```env
APP_NAME="Domain Rotator"
APP_URL=http://localhost:8000
DB_CONNECTION=sqlite
DB_DATABASE=/path/to/database.sqlite
```

### Settings
```php
$settings = [
    'auto_check_interval' => 60,    // seconds
    'auto_rotation_enabled' => false,
    'check_timeout' => 10,          // seconds
    'max_retries' => 3,
];
```

## 🚀 Deployment

### Production
```bash
php artisan config:cache
php artisan route:cache
php artisan view:cache
```

### Docker
```bash
docker-compose up -d
```

## 📝 Changelog

### v1.0.0 - Initial Release
- ✅ Domain rotation system
- ✅ Skiddle API integration
- ✅ Real-time monitoring
- ✅ Auto-rotation
- ✅ Shortlink management
- ✅ Custom domain support
- ✅ Dashboard interface
- ✅ API endpoints

## 📄 License

MIT License

## 🆘 Support

Untuk support dan pertanyaan, silakan buat issue di repository ini.

---

**🌐 Laravel Domain Rotator System** - Powered by Laravel & Skiddle API
