#!/bin/bash
# Script deploy untuk kmagroup.fastmedas.com
# Jalankan di server setelah upload file

echo "=== Deploy KMA Group ==="

# Install dependencies tanpa dev
composer install --no-dev --optimize-autoloader

# Clear semua cache
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan view:clear

# Cache untuk production (lebih cepat)
php artisan config:cache
php artisan route:cache
php artisan view:cache

# Jalankan migration
php artisan migrate --force

# Buat storage symlink
php artisan storage:link

# Set permission folder storage & cache
chmod -R 775 storage
chmod -R 775 bootstrap/cache

echo "=== Deploy selesai! ==="
echo "Akses: https://kmagroup.fastmedas.com"
echo "Admin: https://kmagroup.fastmedas.com/admin"
