debug: also list storage/app/public contents

This commit is contained in:
2026-05-08 10:11:16 +00:00
parent 012e7c92e9
commit 3ca7ceeabb
+16
View File
@@ -58,6 +58,21 @@ Route::get('/debug-storage', function () {
$latestMedia = \DB::table('media')->latest('id')->first(); $latestMedia = \DB::table('media')->latest('id')->first();
// List contents of /app/storage/app/public
$contents = [];
if (is_dir($storageAppPublic)) {
foreach (scandir($storageAppPublic) as $item) {
if (in_array($item, ['.', '..'])) continue;
$full = $storageAppPublic . '/' . $item;
if (is_dir($full)) {
$sub = array_values(array_diff(scandir($full), ['.', '..']));
$contents[$item . '/'] = $sub;
} else {
$contents[] = $item . ' (' . filesize($full) . 'b)';
}
}
}
return response()->json([ return response()->json([
'public_storage' => [ 'public_storage' => [
'path' => $publicStoragePath, 'path' => $publicStoragePath,
@@ -83,6 +98,7 @@ Route::get('/debug-storage', function () {
] : null, ] : null,
'media_disk_config' => config('media-library.disk_name'), 'media_disk_config' => config('media-library.disk_name'),
'app_url' => config('app.url'), 'app_url' => config('app.url'),
'storage_listing' => $contents,
]); ]);
}); });