Storage Structure
The framework uses the following storage structure:Available Commands
storage init
Initialize the storage directory structure by creating all necessary directories and.gitignore files.
- Creates all storage directories
- Generates
.gitignorefiles to keep directories in git but ignore contents - Shows summary of created vs. existing directories
storage link
Create a symbolic link fromstatic/storage to storage/app/public to make user uploads accessible via web server.
Force Recreate
If the symlink already exists, use--force to recreate it:
storage check
Verify that all storage directories exist and have correct permissions.- ✅ OK (R/W): Directory is readable and writable
- ⚠️ READ ONLY: Directory exists but is not writable
- ❌ NO ACCESS: Directory is not readable
- ❌ NOT FOUND: Directory does not exist
storage info
Display detailed information about storage directories.Initial Setup Workflow
When setting up a new project or deployment:Storage Directories Explained
storage/app/public
Purpose: User-uploaded files accessible via web server Examples:- Profile pictures
- Document uploads
- Media files
- User-generated content
static/storage
storage/framework
Purpose: Framework-generated files and cache Contents:cache/- Application cache filesmaintenance.json- Maintenance mode state
storage/logs
Purpose: Application log files Examples:app.log- Application logserror.log- Error logsaccess.log- Access logs
Symlink Creation
Why Symlinks?
Symlinks allow user uploads instorage/app/public to be accessible via the web server at static/storage:
Platform Differences
Linux/macOS:- Uses
std::os::unix::fs::symlink - No special permissions required
- Symlinks work out of the box
- Uses
std::os::windows::fs::symlink_dir - Requires Administrator privileges OR Developer Mode
- If permission denied, enable Developer Mode in Windows Settings
Troubleshooting Symlinks
Error: Symlink already exists- Open Windows Settings
- Go to “Update & Security” → “For developers”
- Enable “Developer Mode”
- Run command again
.gitignore Files
Thestorage init command creates .gitignore files to keep directory structure in git while ignoring contents:
storage/app/.gitignore:
- ✅ Directory structure is tracked in git
- ❌ File contents are NOT tracked (user uploads, logs, cache)
Permission Issues
Read-Only Directories
Problem:No Access
Problem:Production Deployment
Docker Deployment
When deploying with Docker, ensure storage is properly set up:Server Deployment
On production servers:Best Practices
1. Always Initialize Storage First
2. Regular Permission Checks
Runstorage check regularly:
- After deployments
- After system updates
- When debugging file upload issues
- In CI/CD pipelines
3. Backup User Uploads
Backupstorage/app/public regularly:
4. Monitor Disk Usage
Check storage size withstorage info:
5. Clean Cache Periodically
Related Commands
CLI Overview
View all available CLI commands
File Upload Guide
Learn how to handle file uploads
Deployment Guide
Deploy your application
Troubleshooting
Common issues and solutions