#!/bin/bash
# This script clears all Laravel caches and prepares the application
# Run as the www-data user to have proper permissions

cd /var/www/php74/crud

echo "Clearing all Laravel caches..."
php artisan cache:clear
php artisan config:clear  
php artisan view:clear
php artisan route:clear

echo ""
echo "Regenerating caches..."
php artisan config:cache
php artisan route:cache

echo ""
echo "Storage link verification..."
php artisan storage:link

echo ""
echo "✓ All caches cleared and regenerated successfully!"
echo "✓ The wallet page should now load without permission errors."
