Appearance
Zal Ultra Artisan Commands
This document provides a comprehensive reference for all custom Artisan commands available in Zal Ultra ISP CRM.
⚠️ CRITICAL WARNING - READ BEFORE PROCEEDING
These commands are intended for Senior Zal Ultra Experts and System Administrators ONLY.
Running these commands incorrectly can result in:
- Permanent data loss (subscribers, invoices, payments, accounting records)
- Service disruption for all connected subscribers
- Corrupted RADIUS data causing authentication failures
- Financial data inconsistencies that may be impossible to recover
Before running ANY command:
- ✅ Create a full database backup
- ✅ Test on a staging environment first
- ✅ Understand exactly what the command does
- ✅ Use
--dry-runoption when available - ✅ Consult with Onezeroart support if unsure
Commands marked as "DESTRUCTIVE" will permanently delete data. There is NO undo.
If you are not 100% certain about what you are doing, STOP and contact support.
Table of Contents
- Subscriber Management Commands
- Quota Management Commands
- Accounting Commands
- RADIUS Commands
- Graph & Monitoring Commands
- Queue & Cache Commands
- System Health Commands
- OLT Commands
- Maintenance Commands
- Testing Commands
Subscriber Management Commands
Auto Renew Subscribers
Command: php artisan command:autorenew
Purpose: Automatically renews subscribers whose packages have expired based on package and profile settings.
How It Works:
- Finds subscribers with expired or expiring radcheck entries
- Checks if subscriber, salesperson, and package all have auto-renew enabled
- Processes activation with proper accounting (balance cut, profit distribution)
- Prevents duplicate activations within 2 minutes
Usage:
bash
php artisan command:autorenewScheduled: Runs every minute via cron
Related Files:
app/Services/Command/AutorenewServices.php
Expiring Subscribers Notification
Command: php artisan command:expiringsubscribers
Purpose: Sends SMS and email notifications to subscribers whose packages are about to expire.
How It Works:
- Identifies subscribers expiring within configured days
- Sends SMS alerts using configured gateway
- Sends email notifications
- Respects subscriber notification preferences
Usage:
bash
php artisan command:expiringsubscribersScheduled: Runs daily
Usage Data Quota
Command: php artisan command:usagedataquota
Purpose: Processes subscriber data usage and updates quota consumption.
How It Works:
- Calculates data usage from RADIUS accounting
- Updates subscriber's used quota fields
- Triggers quota-based actions (throttling, disconnection)
Usage:
bash
php artisan command:usagedataquotaScheduled: Runs periodically (every few minutes)
Quota Management Commands
Reset Daily Quota
Command: php artisan quota:reset-daily
Purpose: Resets daily data quota for all subscribers at midnight.
How It Works:
- Resets
used_daily_data_quotato 0 for all eligible subscribers - Syncs
total_daily_data_quotafrom package settings - Respects
lock_daily_volume_status(skips locked subscribers) - Prevents duplicate resets on same day
- Logs to
storage/logs/daily_quota.log
Usage:
bash
php artisan quota:reset-dailyScheduled: Runs daily at midnight (00:00)
Reset Weekly Quota
Command: php artisan quota:reset-weekly
Purpose: Resets weekly data quota for subscribers based on their package's reset day setting.
How It Works:
- Checks package's
weekly_reset_daysetting (0=Sunday to 6=Saturday) - Only resets subscribers whose reset day matches current day
- Resets
used_weekly_data_quotato 0 - Syncs
total_weekly_data_quotafrom package settings - Respects
lock_weekly_volume_status - Logs to
storage/logs/weekly_quota.log
Usage:
bash
php artisan quota:reset-weeklyScheduled: Runs daily at midnight (checks if today is reset day)
Accounting Commands
Auto Invoice
Command: php artisan command:autoinvoice
Purpose: Generates automatic invoices for subscribers based on billing cycle.
How It Works:
- Identifies subscribers due for invoicing
- Generates invoices with proper amounts
- Handles pro-rated billing if applicable
Usage:
bash
php artisan command:autoinvoiceScheduled: Runs daily
Flush Accounting Tables
🔴 DESTRUCTIVE COMMAND
This command permanently deletes ALL accounting data. This action CANNOT be undone.
Command: php artisan command:flushaccounting
Purpose: Truncates accounting tables data. DESTRUCTIVE OPERATION - USE WITH CAUTION!
Options:
--all- Flush all accounting tables--tables=- Comma-separated list of specific tables to flush
Available Tables:
paymentsledgersreseller_distributionsactivation_recordsinvoicescashflowsactivation_extra_feesinvoice_package_extra_fees
Usage:
bash
# Flush all accounting tables
php artisan command:flushaccounting --all
# Flush specific tables
php artisan command:flushaccounting --tables=payments,invoicesSafety: Requires typing "YES" and confirmation prompt.
RADIUS Commands
Sync RADIUS Attributes
Command: php artisan command:sync-attributes
Purpose: Synchronizes RADIUS attributes by removing duplicates and keeping only the newest records.
Options:
--dry-run- Show which records would be deleted without actually deleting--force- Execute without confirmation prompt (for scheduled runs)
How It Works:
- Finds duplicate radcheck entries for same username/attribute
- Keeps only the newest record (highest ID)
- Deletes older duplicate records
- Shows summary of cleaned records
Usage:
bash
# Preview what would be deleted
php artisan command:sync-attributes --dry-run
# Run with confirmation
php artisan command:sync-attributes
# Run without confirmation (for cron)
php artisan command:sync-attributes --forceDelete Unused RADIUS Data
🟠 CAUTION - DATA DELETION
This command deletes RADIUS data. Always use --dry-run first to preview what will be deleted.
Command: php artisan command:delete-unused-radius-data
Purpose: Deletes RADIUS data (radcheck, radusergroup, radreply) for usernames not found in subscribers or vouchers tables.
Options:
--dry-run- Show which records would be deleted without actually deleting--force- Execute without confirmation prompt--chunk=1000- Number of records to process at once
How It Works:
- Scans radcheck, radusergroup, radreply tables
- Identifies usernames not in subscribers or vouchers tables
- Deletes orphaned RADIUS entries
- Processes in chunks for memory efficiency
Usage:
bash
# Preview what would be deleted
php artisan command:delete-unused-radius-data --dry-run
# Run cleanup
php artisan command:delete-unused-radius-data --force
# Custom chunk size
php artisan command:delete-unused-radius-data --force --chunk=500Fix Expiration Format
Command: php artisan command:fixExpirationFormat
Purpose: Standardizes radcheck Expiration attribute date format to DD MMM YYYY HH:MM:SS format.
Options:
--dry-run- Simulate the operation without making changes--force- Run without confirmation
How It Works:
- Finds Expiration attributes with non-standard formats
- Converts formats like "01 January 2025" to "01 Jan 2025 00:00:00"
- Handles various date formats (MySQL datetime, full month names, etc.)
- Shows before/after comparison
Usage:
bash
# Preview changes
php artisan command:fixExpirationFormat --dry-run
# Apply changes
php artisan command:fixExpirationFormat --forceGraph & Monitoring Commands
Interface Graph
Command: php artisan command:interface-graph
Purpose: Collects and broadcasts real-time interface bandwidth data via WebSocket.
How It Works:
- Gets active interface graph sessions from session manager
- Collects traffic data from MikroTik routers via API
- Broadcasts data to WebSocket channels for live graphs
- Logs to
graph_interfacechannel
Usage:
bash
php artisan command:interface-graphScheduled: Runs every second via scheduler
Subscriber Graph
Command: php artisan command:subscriber-graph
Purpose: Collects and broadcasts real-time subscriber bandwidth data via WebSocket.
How It Works:
- Gets active subscriber graph sessions
- Collects traffic data for each subscriber
- Broadcasts to WebSocket for live subscriber graphs
- Logs to
graph_subscriberchannel
Usage:
bash
php artisan command:subscriber-graphScheduled: Runs every second via scheduler
Graph Cleanup
Command: php artisan graph:cleanup
Purpose: Cleans up expired graph sessions and stale router connections.
How It Works:
- Removes expired graph sessions from cache
- Closes stale MikroTik API connections
- Frees up memory and resources
Usage:
bash
php artisan graph:cleanupScheduled: Runs every 1-5 minutes
Clear Graph Cache
Command: php artisan graph:clear-cache
Purpose: Clears graph system cache (adapters, NAS details, sessions).
Options:
--nas-id=- Clear cache for specific NAS ID--all- Clear all graph-related cache
Usage:
bash
# Clear cache for specific NAS
php artisan graph:clear-cache --nas-id=5
# Clear all graph cache
php artisan graph:clear-cache --allResource Monitor
Command: php artisan command:realtime-update
Purpose: Dispatches real-time CPU and memory usage data via WebSocket.
How It Works:
- Reads CPU usage from
/proc/statortopcommand - Reads memory usage from
freecommand - Broadcasts via ResourceMonitorEvent
Usage:
bash
php artisan command:realtime-updateScheduled: Runs every second
Queue & Cache Commands
Clear Redis Queue
🔴 DESTRUCTIVE COMMAND - EMERGENCY USE ONLY
This command permanently deletes ALL queued jobs (SMS, emails, reports, etc.). Use only in emergencies.
Command: php artisan queue:clear-redis
Purpose: Clears Redis queue to free up memory. EMERGENCY USE ONLY!
Arguments:
queue- The name of the queue to clear (default: "default")
Options:
--all- Clear all queues--confirm- Skip confirmation prompt
How It Works:
- Deletes all jobs from specified queue(s)
- Clears delayed and reserved jobs
- Shows queue sizes before clearing
Usage:
bash
# Clear default queue
php artisan queue:clear-redis default --confirm
# Clear all queues
php artisan queue:clear-redis --all --confirm
# Clear specific queue
php artisan queue:clear-redis sms --confirmWarning: This permanently deletes all queued jobs!
System Health Commands
System Health
🟠 CAUTION - SYSTEM CRITICAL
The --flush and --clear-cache options affect license data. Use only when instructed by Onezeroart support.
Command: php artisan system:health
Purpose: System health management and diagnostics for license verification.
Options:
--init- Initialize system metrics for first time setup--check- Perform health check and sync with license portal--status- Show current system status (default)--flush- Clear system_metrics data and re-sync with portal--clear-cache- Clear license cache file (empty license.txt)
Usage:
bash
# Show current status
php artisan system:health
php artisan system:health --status
# Initialize system (first time setup)
php artisan system:health --init
# Force health check and sync
php artisan system:health --check
# Flush and re-sync (after database migration)
php artisan system:health --flush
# Clear license cache file
php artisan system:health --clear-cacheStatus Values:
healthy- License valid, all operations allowedgrace_period- License sync failed, temporary grace period activesafe_mode- License issues, read-only mode (admin only)
OLT Commands
Diagnose OLT
Command: php artisan olt:diagnose {olt_id}
Purpose: Diagnoses OLT device and discovers supported SNMP OIDs.
Arguments:
olt_id- The ID of the OLT to diagnose
How It Works:
- Tests system information OIDs
- Tests vendor-specific OIDs (BDCOM, Huawei, ZTE, V-Sol, MikroTik)
- Shows which OIDs work with the device
- Helps identify OLT type for adapter implementation
Usage:
bash
php artisan olt:diagnose 1Discover ONUs
Command: php artisan olt:discover-onus
Purpose: Discovers ONUs from OLT devices via SNMP.
Options:
--olt-id=- Specific OLT ID to discover ONUs from--sync- Run synchronously instead of queuing
How It Works:
- Queries enabled OLTs via SNMP
- Discovers connected ONUs (serial numbers, MAC addresses)
- Creates/updates ONU records in database
- Can run as queued job or synchronously
Usage:
bash
# Discover from all enabled OLTs (queued)
php artisan olt:discover-onus
# Discover from specific OLT
php artisan olt:discover-onus --olt-id=5
# Run synchronously
php artisan olt:discover-onus --syncMonitor ONU Metrics
Command: php artisan olt:monitor-metrics
Purpose: Monitors signal metrics (RX power, TX power) for ONUs.
Options:
--olt-id=- Monitor ONUs from specific OLT only--online-only- Monitor only online ONUs--limit=100- Maximum number of ONUs to monitor per run--sync- Run synchronously instead of queuing
How It Works:
- Queries ONU signal metrics via SNMP
- Updates ONU records with latest metrics
- Prioritizes least recently updated ONUs
- Shows progress bar during execution
Usage:
bash
# Monitor all ONUs (queued)
php artisan olt:monitor-metrics
# Monitor online ONUs only
php artisan olt:monitor-metrics --online-only
# Monitor specific OLT with limit
php artisan olt:monitor-metrics --olt-id=5 --limit=50 --syncMaintenance Commands
Clear All Logs
🟠 CAUTION - DATA DELETION
This command deletes all log files. You may lose important debugging information.
Command: php artisan logs:clear-all
Purpose: Deletes all log files from storage/logs directory.
Options:
--force- Force deletion without confirmation
How It Works:
- Scans storage/logs directory recursively
- Shows total files and size
- Deletes all log files with progress bar
- Shows summary of freed space
Usage:
bash
# With confirmation
php artisan logs:clear-all
# Without confirmation (for automation)
php artisan logs:clear-all --forceClear Tables
Command: php artisan command:cleartables
Purpose: Clears unnecessary tables (jobs, CoA request logs).
How It Works:
- Clears old entries from jobs table
- Clears CoA request logs
Usage:
bash
php artisan command:cleartablesScheduled: Runs daily at 4 AM
Clear Stale Sessions
Command: php artisan command:clearstalesession
Purpose: Clears stale RADIUS sessions from radacct table.
How It Works:
- Identifies sessions without stop time that are stale
- Cleans up orphaned session records
- Helps maintain accurate online user count
Usage:
bash
php artisan command:clearstalesessionCoA Request
Command: php artisan command:coarequest
Purpose: Processes pending CoA (Change of Authorization) requests.
How It Works:
- Finds pending CoA requests in queue
- Sends CoA packets to NAS devices
- Updates request status
Usage:
bash
php artisan command:coarequestScheduled: Runs frequently (every minute or less)
Testing Commands
Test CoA Performance
Command: php artisan test:coa-performance
Purpose: Tests CoA processing performance with current setup.
How It Works:
- Checks online subscriber count
- Verifies database schema (CoA tracking columns)
- Checks queue configuration (sync, database, redis)
- Tests Redis connection if applicable
- Estimates processing time
- Provides performance recommendations
- Optionally runs quick test with 10 subscribers
Usage:
bash
php artisan test:coa-performanceOutput Includes:
- Online subscriber count
- Queue driver status
- Estimated processing time
- Performance recommendations
- Optional quick test
Scheduled Commands Summary
| Command | Schedule | Purpose |
|---|---|---|
command:autorenew | Every minute | Auto-renew expired subscribers |
command:coarequest | Every minute | Process CoA requests |
command:usagedataquota | Every 5 minutes | Update usage quotas |
quota:reset-daily | Daily at 00:00 | Reset daily quotas |
quota:reset-weekly | Daily at 00:00 | Reset weekly quotas (on reset day) |
command:expiringsubscribers | Daily | Send expiration notifications |
command:autoinvoice | Daily | Generate auto invoices |
command:cleartables | Daily at 04:00 | Clean up old data |
command:clearstalesession | Hourly | Clean stale sessions |
command:sync-attributes | Weekly | Clean duplicate RADIUS entries |
graph:cleanup | Every 1-5 minutes | Clean graph sessions |
command:interface-graph | Every second | Collect interface data |
command:subscriber-graph | Every second | Collect subscriber data |
command:realtime-update | Every second | Broadcast system metrics |
Best Practices
- Always use
--dry-runfirst for destructive commands - Use
--forcefor scheduled/automated runs to skip prompts - Check logs after running commands:
tail -f storage/logs/laravel.log - Monitor queue when using queued jobs:
php artisan queue:work - Backup database before running flush/delete commands
Troubleshooting
Command Not Found
bash
php artisan list | grep command:Permission Issues
bash
sudo chown -R www-data:www-data storage
sudo chmod -R 775 storageQueue Jobs Not Processing
bash
php artisan queue:restart
php artisan queue:work --tries=3View Failed Jobs
bash
php artisan queue:failed
php artisan queue:retry all