#!/bin/bash set -e echo "[+] Starting Laravel Initialization Script..." echo "[+] Ensuring Laravel storage and cache directories exist..." mkdir -p storage/framework/cache/data \ storage/framework/views \ storage/framework/sessions \ storage/logs \ bootstrap/cache[cite: 4, 5] if [ ! -f .env ]; then echo "[+] .env file not found, creating from .env.example..." cp .env.example .env fi if ! grep -q "APP_KEY=base64:" .env; then echo "[+] Generating application key..." php artisan key:generate --force fi echo "[+] Clearing stale Laravel configurations and views..." php artisan config:clear || true php artisan view:clear || true php artisan cache:clear || true[cite: 7] echo "[+] Setting permissions for storage and bootstrap/cache..." chmod -R 777 storage bootstrap/cache[cite: 5] echo "[+] Laravel is ready! Launching application..." exec "$@"