getFilePattern($directoryName); return collect(glob($files)) ->map(function ($filename) { return include $filename; }) ->flatten(1) ->all(); } /** * Build the glob pattern to load partials from the directory. * * Assumes it is always relative to the current directory, and that the * filters are always in files with a .php extension. * * @param string $directoryName The name of the directory. * * @return string The full path. */ protected function getFilePattern($directoryName) { return getcwd() . DIRECTORY_SEPARATOR . $directoryName . DIRECTORY_SEPARATOR . '*.php'; } }