schneespur/app/Http/Controllers/StorageFallbackController.php
Michael 2c63440ed8 Revert: move code back to project root from schneespur/ subdirectory
- Reverts the schneespur/ subdirectory restructure (b8e426b)
- Restores package.json and vite.config.js (needed for npm build, were
  removed in an earlier cleanup before the restructure)
- Updates public/build/ assets with current Vite output (new content hashes)
2026-05-17 18:24:26 +00:00

27 lines
731 B
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\Response;
class StorageFallbackController extends Controller
{
public function __invoke(string $path): Response
{
$disk = Storage::disk('public');
if (! $disk->exists($path)) {
abort(404);
}
$mimeType = $disk->mimeType($path) ?: 'application/octet-stream';
$lastModified = $disk->lastModified($path);
return response($disk->get($path), 200, [
'Content-Type' => $mimeType,
'Cache-Control' => 'public, max-age=604800',
'Last-Modified' => gmdate('D, d M Y H:i:s', $lastModified) . ' GMT',
]);
}
}