Command Reference
Available Commands
Data Lens provides several artisan commands to help manage and maintain your reporting system.
data-lens:install
Interactive installation wizard for Data Lens.
php artisan data-lens:install [--force]
Options:
- --force - Force the operation to run, overwriting existing files
Features:
- Detects existing Filament panels
- Publishes configuration and migrations
- Runs migrations with confirmation
- Configures plugin settings interactively
- Registers plugin in panel providers
- Generates security policies
data-lens:clear-cache
Clear Data Lens cache entries.
php artisan data-lens:clear-cache [--type=TYPE] [--force]
Options:
- --type - Specific cache type to clear (default: all)
- all - Clear all Data Lens cache
- relationship_class - Clear relationship class cache
- relationship_type - Clear relationship type cache
- model_relationships - Clear model relationships cache
- model_fields - Clear model fields cache
- filter_type - Clear filter type cache
- --force - Skip confirmation prompt
Examples:
# Clear all cache
php artisan data-lens:clear-cache
# Clear only model fields cache
php artisan data-lens:clear-cache --type=model_fields
# Clear cache without confirmation
php artisan data-lens:clear-cache --force
Note: When using cache drivers that don't support tags (file, database), clearing a specific type will clear ALL Data Lens cache.
data-lens:suggest-excluded-columns
Scan models for sensitive columns that should be excluded from reports.
php artisan data-lens:suggest-excluded-columns [--model=MODEL] [--format=FORMAT]
Options:
- --model - Specific model class to scan (e.g., "App\Models\User")
- --format - Output format
- table (default) - Display as formatted table
- config - Output as copy-pastable config array
Examples:
# Scan all models
php artisan data-lens:suggest-excluded-columns
# Scan specific model
php artisan data-lens:suggest-excluded-columns --model="App\Models\User"
# Get config-ready output
php artisan data-lens:suggest-excluded-columns --format=config
Risk Levels:
- HIGH: Passwords, tokens, API keys, secrets
- MEDIUM: Personal information, financial data, salaries
- LOW: Tracking data, analytics, configuration
data-lens:check-scheduled-reports
Check for scheduled reports that are due and queue them for processing.
php artisan data-lens:check-scheduled-reports [--debug]
Options:
- --debug - Enable detailed debug output
Usage: This command should be scheduled to run regularly via Laravel's task scheduler:
// In routes/console.php (Laravel 11) or app/Console/Kernel.php
Schedule::command('data-lens:check-scheduled-reports')->everyMinute();
Features:
- Identifies reports due for generation
- Queues report generation jobs
- Respects timezone settings
- Handles recurring schedules (daily, weekly, monthly)
- Updates next run times
Deployment Commands
Cache Management in Production
# Clear cache after deploying model changes
php artisan data-lens:clear-cache --force
# Warm cache by accessing reports (optional)
php artisan tinker
>>> \Padmission\DataLens\Services\ModelService::make()->getAvailableModels();
Multi-Tenant Deployments
For multi-tenant applications, cache is isolated per tenant. To clear cache for all tenants:
# Clear all tenant caches
php artisan data-lens:clear-cache --force
# Or manually clear specific tenant cache
php artisan tinker
>>> app()->bind('tenant.id', fn() => 1); // Set tenant context
>>> \Padmission\DataLens\Services\CacheManager::clear();
Maintenance Commands
Database Cleanup
Remove old schedule history:
-- Remove history older than 90 days
DELETE FROM custom_report_schedule_history
WHERE created_at < DATE_SUB(NOW(), INTERVAL 90 DAY);
Queue Monitoring
Monitor report generation jobs:
# Check failed jobs
php artisan queue:failed
# Retry failed report jobs
php artisan queue:retry all
Troubleshooting Commands
Debug Report Generation
# Test report generation without scheduling
php artisan tinker
>>> $report = \Padmission\DataLens\Models\CustomReport::find(1);
>>> $service = app(\Padmission\DataLens\Services\ReportDataService::class);
>>> $data = $service->getData($report, 1, 50);
>>> dd($data);
Check Configuration
# View current configuration
php artisan tinker
>>> config('data-lens');