#!/bin/bash

# Clear Laravel caches
php artisan cache:clear
php artisan route:clear
php artisan view:clear

# Remove old scribe cache if exists
rm -rf .scribe/endpoints.cache

# Generate new documentation
php artisan scribe:generate

# Fix permissions
chown -R root:root public/docs
chown -R root:root storage
chown -R root:root bootstrap/cache

# Set proper permissions
chmod -R 775 storage
chmod -R 775 bootstrap/cache
chmod -R 775 public/docs

chmod -R 777 ./

echo "All commands completed and permissions fixed!"
