Troubleshooting
Common Issues and Troubleshooting
This guide covers common issues you may encounter when working with Laravolt v7 and provides systematic solutions.
Installation and Setup Issues
Issue: Composer Install Fails with Package Conflicts
Symptom:
composer require laravolt/laravolt# Error: Your requirements could not be resolved to an installable set of packages.Diagnosis:
- Laravel version incompatibility (Laravolt v7 requires Laravel 10+)
- PHP version mismatch (requires PHP 8.1+)
- Conflicting package versions in
composer.json
Solution:
# 1. Check Laravel versionphp artisan --version# Expected: Laravel Framework 10.x or 11.x# 2. Check PHP versionphp -v# Expected: PHP 8.1.0 or higher# 3. Update composer.json constraintscomposer require laravolt/laravolt --with-all-dependencies# 4. If still failing, check for conflictscomposer why-not laravolt/laravoltVerification:
composer show laravolt/laravolt# Should show version 7.x.xphp artisan vendor:publish --tag=laravolt-config# Should publish config files successfullyIssue: Missing Service Provider After Installation
Symptom:
php artisan config:cache# Error: Class 'Laravolt\LaravoltServiceProvider' not foundDiagnosis:
- Service provider not auto-discovered
- Cached config contains stale references
- Package not properly installed
Solution:
# 1. Clear all cachesphp artisan config:clearphp artisan cache:clearphp artisan route:clearphp artisan view:clear# 2. Verify package installationcomposer show laravolt/laravolt# 3. Manually register provider (Laravel 10 only, if auto-discovery fails)# Add to config/app.php:# 'providers' => [# Laravolt\LaravoltServiceProvider::class,# ]# 4. Rebuild cachesphp artisan config:cachephp artisan route:cacheVerification:
php artisan route:list | grep laravolt# Should show Laravolt routesphp artisan config:show laravolt# Should display Laravolt configurationThunderclap Generation Issues
Issue: Thunderclap Command Not Found
Symptom:
php artisan thunderclap:generate Product# Command "thunderclap:generate" is not defined.Diagnosis:
- Thunderclap package not installed
- Service provider not loaded
- Command not registered
Solution:
# 1. Verify Thunderclap is installedcomposer show laravolt/thunderclap# 2. If not installed, add itcomposer require laravolt/thunderclap# 3. Publish Thunderclap configphp artisan vendor:publish --tag=thunderclap-config# 4. Clear cachesphp artisan config:clear# 5. Verify command is availablephp artisan list | grep thunderclapVerification:
php artisan thunderclap:generate --help# Should show command usage and optionsIssue: Generated Files Have Wrong Namespace
Symptom: Generated model has namespace App\Models\Product but should be App\Domains\Product\Models\Product.
Diagnosis:
- Thunderclap config not customized for domain-driven structure
- Default Laravel namespace conventions applied
Solution:
# 1. Edit config/thunderclap.php# Set custom namespace patterns:'namespaces' => [ 'model' => 'App\\Domains\\{domain}\\Models', 'controller' => 'App\\Domains\\{domain}\\Http\\Controllers', 'request' => 'App\\Domains\\{domain}\\Http\\Requests', 'resource' => 'App\\Domains\\{domain}\\Http\\Resources',],'paths' => [ 'model' => 'app/Domains/{domain}/Models', 'controller' => 'app/Domains/{domain}/Http/Controllers', 'request' => 'app/Domains/{domain}/Http/Requests', 'resource' => 'app/Domains/{domain}/Http/Resources',],# 2. Regenerate with domain flagphp artisan thunderclap:generate Product --domain=Catalog# 3. Verify generated filesls -la app/Domains/Catalog/Models/Verification:
# Check model namespacehead -n 5 app/Domains/Catalog/Models/Product.php# Should show: namespace App\Domains\Catalog\Models;Issue: Migration Already Exists Error
Symptom:
php artisan thunderclap:generate Order# Error: Migration already exists: create_orders_tableDiagnosis:
- Previous migration with same name exists
- Thunderclap trying to create duplicate migration
Solution:
# Option 1: Skip migration generationphp artisan thunderclap:generate Order --skip-migration# Option 2: Remove old migration firstrm database/migrations/*_create_orders_table.php# Option 3: Use different table namephp artisan thunderclap:generate Order --table=customer_orders# Option 4: Force regeneration (overwrites existing)php artisan thunderclap:generate Order --forceVerification:
ls -la database/migrations/ | grep orders# Should show only one migration fileForm Validation Issues
Issue: Custom Validation Rule Not Working
Symptom: Form submits successfully despite custom validation rule that should fail.
Diagnosis:
- Validation rule not registered
- Rule class not found
- Rule logic incorrect
Solution:
# 1. Verify rule class existsls -la app/Rules/# 2. Check rule is imported in Request classuse App\Rules\UniqueProductSku;public function rules(): array{ return [ 'sku' => ['required', 'string', new UniqueProductSku($this->product)], ];}# 3. Test rule in isolationphp artisan tinker$rule = new App\Rules\UniqueProductSku(null);$rule->passes('sku', 'TEST-001');// Should return false if SKU existsVerification:
# Submit form with invalid data via HTTP testphp artisan test --filter=ProductValidationTestIssue: Validation Messages Not Displaying
Symptom: Form validation fails but no error messages appear in the UI.
Diagnosis:
- Blade template missing
@errordirectives - Session flash not persisting
- JavaScript intercepting form submission
Solution:
# 1. Check Blade template has error display<input type="text" name="name" value="{{ old('name') }}">@error('name') <span class="text-red-500 text-sm">{{ $message }}</span>@enderror# 2. Verify session driver is workingphp artisan tinkersession()->put('test', 'value');session()->get('test'); // Should return 'value'# 3. Check for JavaScript form hijacking# Look for event.preventDefault() in form submit handlers# 4. Test with PrelineForm component (recommended)<x-preline-form :action="route('products.store')"> <x-preline-input name="name" label="Product Name" required /> <x-preline-button type="submit">Save</x-preline-button></x-preline-form>Verification:
# Submit form with invalid data and check responsecurl -X POST http://localhost/products \ -d "name=" \ -H "X-Requested-With: XMLHttpRequest"# Should return 422 with validation errors JSONAsset Build Issues
Issue: Vite Build Fails with Module Not Found
Symptom:
npm run build# Error: Could not resolve '@laravolt/preline'Diagnosis:
- NPM package not installed
- Import path incorrect
- Node modules cache stale
Solution:
# 1. Install Laravolt frontend assetsnpm install @laravolt/preline# 2. Clear node_modules and reinstallrm -rf node_modules package-lock.jsonnpm install# 3. Verify import path in app.jsimport '@laravolt/preline';# 4. Rebuild assetsnpm run buildVerification:
ls -la public/build/# Should contain compiled assets# Check browser console for errorsnpm run dev# Visit app in browser, check consoleIssue: Tailwind Classes Not Applied
Symptom: Laravolt components render but have no styling.
Diagnosis:
- Tailwind not scanning Laravolt views
- Preline plugin not loaded
- CSS not imported
Solution:
# 1. Update tailwind.config.jsexport default { content: [ './resources/**/*.blade.php', './resources/**/*.js', './vendor/laravolt/**/*.blade.php', // Add this ], plugins: [ require('@laravolt/preline/plugin'), // Add this ],}# 2. Import Preline CSS in app.css@import '@laravolt/preline';# 3. Rebuild assetsnpm run build# 4. Clear view cachephp artisan view:clearVerification:
# Inspect compiled CSSgrep "preline" public/build/assets/*.css# Should find Preline classesDatabase Migration Issues
Issue: Foreign Key Constraint Fails
Symptom:
php artisan migrate# SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraintDiagnosis:
- Referenced table doesn't exist yet
- Column types don't match
- Migration order incorrect
Solution:
# 1. Check migration timestampsls -la database/migrations/ | grep -E "(users|products|orders)"# 2. Ensure parent table migrates first# Rename migration file to adjust order:mv database/migrations/2024_01_15_create_orders_table.php \ database/migrations/2024_01_16_create_orders_table.php# 3. Verify column types match// Parent table (users)$table->id(); // bigint unsigned// Child table (orders)$table->foreignId('user_id') // bigint unsigned - matches! ->constrained() ->cascadeOnDelete();# 4. Reset and remigratephp artisan migrate:freshVerification:
php artisan db:show# Check foreign keys are createdmysql -e "SHOW CREATE TABLE orders\G"# Should show FOREIGN KEY constraintsIssue: Migration Rollback Fails
Symptom:
php artisan migrate:rollback# Error: SQLSTATE[42S02]: Base table or view not foundDiagnosis:
down()method references non-existent table- Manual database changes broke migration state
- Migration batch tracking corrupted
Solution:
# 1. Check migrations tablephp artisan db:table migrations# 2. Manually fix migration statephp artisan tinkerDB::table('migrations')->where('migration', 'like', '%orders%')->delete();# 3. Fix down() method to check table existencepublic function down(): void{ Schema::dropIfExists('orders');}# 4. Reset migrations cleanlyphp artisan migrate:freshVerification:
php artisan migrate:status# All migrations should show "Ran"Performance and Debugging
Issue: Slow Page Load with Suitable Tables
Symptom: Table page takes 5+ seconds to load with 1000 records.
Diagnosis:
- Missing database indexes
- N+1 query problem
- No pagination applied
Solution:
# 1. Enable query loggingDB::enableQueryLog();// ... render tabledd(DB::getQueryLog());# 2. Add indexes to frequently queried columnsSchema::table('products', function (Blueprint $table) { $table->index('status'); $table->index('category_id'); $table->index(['status', 'created_at']);});# 3. Eager load relationships in Suitable configpublic function query(): Builder{ return Product::query() ->with(['category', 'supplier']) // Eager load ->select('products.*');}# 4. Ensure pagination is enabledpublic function perPage(): int{ return 50; // Limit results}Verification:
# Check query countphp artisan debugbar:clear# Reload page, check Debugbar# Should show < 10 queries for table renderGetting Help
If you encounter an issue not covered here:
- Check logs:
storage/logs/laravel.log - Enable debug mode: Set
APP_DEBUG=truein.env - Run diagnostics:Bashphp artisan aboutphp artisan config:show laravolt
- Search documentation: Use
/llms.txtindex - Community support: GitHub Issues, Discord, or Laravel forums
Quick Diagnostic Commands
# System health checkphp artisan about# Clear all cachesphp artisan optimize:clear# Verify Laravolt installationcomposer show laravolt/*# Check routesphp artisan route:list | grep laravolt# Database statusphp artisan migrate:status# View compiled configphp artisan config:show laravolt# Test database connectionphp artisan db:show