diff --git a/src/Illuminate/Foundation/Console/AboutCommand.php b/src/Illuminate/Foundation/Console/AboutCommand.php index b7d39b775c4..9c9a81b279d 100644 --- a/src/Illuminate/Foundation/Console/AboutCommand.php +++ b/src/Illuminate/Foundation/Console/AboutCommand.php @@ -165,6 +165,7 @@ protected function gatherApplicationInformation() $formatEnabledStatus = fn ($value) => $value ? '<fg=yellow;options=bold>ENABLED</>' : 'OFF'; $formatCachedStatus = fn ($value) => $value ? '<fg=green;options=bold>CACHED</>' : '<fg=yellow;options=bold>NOT CACHED</>'; + $formatStorageLinkedStatus = fn ($value) => $value ? '<fg=green;options=bold>LINKED</>' : '<fg=yellow;options=bold>NOT LINKED</>'; static::addToSection('Environment', fn () => [ 'Application Name' => config('app.name'), @@ -177,6 +178,7 @@ protected function gatherApplicationInformation() 'Maintenance Mode' => static::format($this->laravel->isDownForMaintenance(), console: $formatEnabledStatus), 'Timezone' => config('app.timezone'), 'Locale' => config('app.locale'), + 'Storage Linked' => static::format(file_exists(public_path('storage')), console: $formatStorageLinkedStatus), ]); static::addToSection('Cache', fn () => [ @@ -214,6 +216,10 @@ protected function gatherApplicationInformation() 'Session' => config('session.driver'), ])); + static::addToSection('Storage', fn () => [ + ...$this->checkStoragePaths($formatStorageLinkedStatus), + ]); + (new Collection(static::$customDataResolvers))->each->__invoke(); } @@ -318,4 +324,21 @@ public static function flushState() static::$customDataResolvers = []; } + + /** + * Check storage symbolic links status. + * + * @param callable $formatStorageLinkedStatus Formatter for link status + * @return array<string,mixed> Array of paths and their link status + */ + protected function checkStoragePaths(callable $formatStorageLinkedStatus): array + { + return collect(config('filesystems.links', [])) + ->mapWithKeys(function ($target, $link) use ($formatStorageLinkedStatus) { + $path = Str::replace(public_path(), '', $link); + + return [public_path($path) => static::format(file_exists($link), console: $formatStorageLinkedStatus)]; + }) + ->toArray(); + } }