Skip to content

Troubleshooting ​

Troubleshooting ​

Common Issues and Solutions ​

1. "Class 'Mylekha\RecordApi\RecordApiServiceProvider' not found" ​

Solution:

bash
# Clear composer autoload cache
composer dump-autoload

# Ensure package is properly installed
composer require mylekha/record-api

# Clear Laravel caches
php artisan config:clear
php artisan cache:clear

2. "Configuration file not found" ​

Solution:

bash
# Publish configuration files
php artisan vendor:publish --provider="Mylekha\RecordApi\RecordApiServiceProvider"

# Or publish specific configs
php artisan vendor:publish --tag=record-api-config

3. "Database connection issues" ​

Solution:

bash
# Test database connection
php artisan record-api:validate --verbose

# Check database configuration
php artisan config:show database.connections.mysql

# Verify migrations
php artisan migrate:status

4. "Permission denied errors" (using Spatie Permission) ​

Solution (if you are using Spatie Laravel Permission):

bash
# Ensure permissions are created
php artisan permission:create-permission view_users
php artisan permission:create-permission create_users

# Assign permissions to user
php artisan tinker
>>> $user = \App\Models\User::find(1);
>>> $user->givePermissionTo('view_users');

5. "Auth token issues" (JWT/Sanctum/Passport/etc) ​

Solution:

bash
# Clear config cache
php artisan config:clear

Verify your guard configuration:

  • config/record-api.php → auth.guard
  • config/auth.php → the configured guard/driver setup

6. "API routes not working" ​

Solution:

bash
# Check route registration
php artisan route:list | grep api

# Verify middleware configuration
php artisan route:list --middleware=api

# Clear route cache
php artisan route:clear

7. "Command summary" ​

Available artisan commands:Solution:

bash
  # Clean old audit logs based on retention configuration
  php artisan record-api:clean-audit-logs
  # Setup Record API package: publish configs and create record/audit configurations using config/record.php + config/records/tables/*.php + config/records/globalFunctions/*.php
  php artisan record-api:setup
  # Create a RecordTableType config file under config/records/tables
  php artisan record-api:record customers
  # Populate RecordTableType columns in config/records/tables PHP files based on DB schema
  php artisan record-api:sync-record-columns
  # Validate Record API package setup and configuration
  php artisan record-api:validate

Debug Mode ​

Enable debug mode for detailed error information:

env
APP_DEBUG=true
LOG_LEVEL=debug

Validation Command ​

Use the validation command to diagnose issues:

bash
# Run comprehensive validation
php artisan record-api:validate --verbose --fix

Released under the MIT License.