Helpers.php 592 B

12345678910111213141516171819202122
  1. <?php
  2. namespace Goodquestiondev;
  3. use Illuminate\Support\Str;
  4. class Helpers
  5. {
  6. /**
  7. * Get all files and folders from a specific folder exluding the dots
  8. *
  9. * @param string $path the path to the folder, no need to pass the / on the start or end as it gets stripped out
  10. *
  11. * @return array An array of all the files and folders from a specific local path
  12. */
  13. public static function getFiles(string $path) : array
  14. {
  15. $strippedPath = Str::of($path)->trim('/');
  16. return array_diff(scandir(dirname(__DIR__) . $strippedPath), ['..', '.']);
  17. }
  18. }