Hide app files from listing by default with a configuration option to override

This commit is contained in:
Chris Kankiewicz
2019-12-14 23:52:25 -07:00
parent d7fa7e9bbd
commit 9fe558dc56
2 changed files with 13 additions and 1 deletions

View File

@@ -11,6 +11,9 @@ use Tightenco\Collect\Support\Collection;
class FilesComposer
{
/** @const Application paths to be hidden */
protected const APP_FILES = ['app', 'vendor', 'index.php'];
/** @var Config Application config */
protected $config;
@@ -27,7 +30,9 @@ class FilesComposer
$this->hiddenFiles = Collection::make(
$this->config->get('hidden_files', [])
)->map(function (string $file) {
)->when($config->get('hide_app_files', true), function ($collection) {
return $collection->merge(self::APP_FILES);
})->map(function (string $file) {
return glob($file, GLOB_BRACE | GLOB_NOSORT);
})->flatten()->map(function (string $file) {
return realpath($file);

View File

@@ -31,6 +31,13 @@ return [
*/
'date_format' => 'Y-m-d H:i:s',
/**
* Whether or not to hide application files/directories form the listing.
*
* Default value: true
*/
'hide_app_files' => true,
/**
* Description here...
*