# Cache-busting with commit hash (for Laravel Mix assets)

Since the project uses `asset()` helper instead of `mix()`, here's the recommended pattern for deterministic cache-busting:

## Blade Template Pattern

```php
@php 
$assetVersion = env('APP_ASSET_VERSION', 'dev-' . time()); 
@endphp

<!-- Replace time() with deterministic version -->
<link rel="stylesheet" href="{{ asset('css/app.css') }}?v={{ $assetVersion }}">
<script src="{{ asset('js/app.js') }}?v={{ $assetVersion }}" defer></script>
```

## Environment Configuration

### Local Development (.env)
```
APP_ASSET_VERSION=dev
```

### Production (.env.production)
```
APP_ASSET_VERSION={{COMMIT_HASH}}
```

### CI/CD Pipeline
The GitHub Actions workflow automatically sets:
```
APP_ASSET_VERSION=${GITHUB_SHA::7}
```

## Benefits

1. **Deterministic**: Same commit = same cache key
2. **Deploy-safe**: New commits automatically break cache
3. **Dev-friendly**: Local development uses 'dev' or timestamp
4. **CDN-compatible**: Works with any caching layer
5. **No Mix dependency**: Compatible with disabled `mix.version()`

## Implementation

1. Update your main layout templates with the pattern above
2. Set `APP_ASSET_VERSION=dev` in your `.env` file
3. Deploy - CI will automatically set commit hash in production
