Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Providers;
- use Illuminate\Support\ServiceProvider;
- class HelperServiceProvider extends ServiceProvider {
- /**
- * Bootstrap services.
- *
- * @return void
- */
- public function boot() {
- //
- }
- /**
- * Register services.
- *
- * @return void
- */
- public function register() {
- $files = $this->glob_recursive(app_path() . '/Helpers/*.php');
- foreach ($files as $file) {
- require_once($file);
- }
- }
- function glob_recursive($pattern, $flags = 0) {
- $files = glob($pattern, $flags);
- foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
- $files = array_merge($files, $this->glob_recursive($dir . '/' . basename($pattern), $flags));
- }
- return $files;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement