Created
February 13, 2015 01:34
-
-
Save Phelms215/ef5479aec9a35bc54f96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class PluginServiceProvider extends ServiceProvider { | |
/** | |
* Bootstrap any application services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
// | |
} | |
/** | |
* Register any plugin services | |
* | |
* Scan plugin folder and dynamically register all Facades. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
$dirs = array_filter(glob(app_path() . '/Plugins/*'), 'is_dir'); | |
foreach($dirs as $pluginPath): | |
$cleanUp = explode("/", $pluginPath); | |
$folder_name = end($cleanUp); | |
$className = "\\Plugins\\$folder_name"; | |
$this->app->bind(strtolower($folder_name), $className); | |
endforeach; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment