Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Providers;
  4.  
  5. use Illuminate\Support\ServiceProvider;
  6.  
  7. class HelperServiceProvider extends ServiceProvider {
  8.  
  9. /**
  10. * Bootstrap services.
  11. *
  12. * @return void
  13. */
  14. public function boot() {
  15. //
  16. }
  17.  
  18. /**
  19. * Register services.
  20. *
  21. * @return void
  22. */
  23. public function register() {
  24. $files = $this->glob_recursive(app_path() . '/Helpers/*.php');
  25. foreach ($files as $file) {
  26. require_once($file);
  27. }
  28. }
  29.  
  30. function glob_recursive($pattern, $flags = 0) {
  31. $files = glob($pattern, $flags);
  32. foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
  33. $files = array_merge($files, $this->glob_recursive($dir . '/' . basename($pattern), $flags));
  34. }
  35. return $files;
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement