-
app/Providers/HelperServiceProvider.php
Open in GitHubuse Illuminate\Support\ServiceProvider; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; class HelperServiceProvider extends ServiceProvider { public function boot() { $rdi = new RecursiveDirectoryIterator(app_path('Helpers'.DIRECTORY_SEPARATOR.'Global')); $it = new RecursiveIteratorIterator($rdi); while ($it->valid()) { if ( ! $it->isDot() && $it->isFile() && $it->isReadable() && $it->current()->getExtension() === 'php' && strpos($it->current()->getFilename(), 'Helper') ) { require $it->key(); } $it->next(); } } }
-
config/app.php
Open in GitHubreturn [ // 'providers' => [ // App\Providers\HelperServiceProvider::class, // ], // ];