12345678910111213141516171819202122 |
- <?php
- namespace Goodquestiondev;
- use Illuminate\Support\Str;
- class Helpers
- {
- /**
- * Get all files and folders from a specific folder exluding the dots
- *
- * @param string $path the path to the folder, no need to pass the / on the start or end as it gets stripped out
- *
- * @return array An array of all the files and folders from a specific local path
- */
- public static function getFiles(string $path) : array
- {
- $strippedPath = Str::of($path)->trim('/');
- return array_diff(scandir(dirname(__DIR__) . $strippedPath), ['..', '.']);
- }
- }
|