Last active
October 25, 2016 20:42
-
-
Save warrickbayman/28a28675513225edcc879af83fe70883 to your computer and use it in GitHub Desktop.
Laravel: Load development only packages
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\Foundation\AliasLoader; | |
use Illuminate\Support\ServiceProvider; | |
class DevelopmentServiceProvider extends ServiceProvider | |
{ | |
protected $providers = [ | |
\Barryvdh\Debugbar\ServiceProvider::class | |
]; | |
protected $facades = [ | |
'Debugbar' => \Barryvdh\Debugbar\Facade::class | |
]; | |
/** | |
* Bootstrap the application services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
// | |
} | |
/** | |
* Register the application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
if ($this->app->environment() == 'local') { | |
foreach ($this->providers as $provider) { | |
$this->app->register($provider); | |
} | |
$loader = AliasLoader::getInstance(); | |
foreach ($this->facades as $alias => $facade) { | |
$loader->alias($alias, $facade); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment