Skip to content

Instantly share code, notes, and snippets.

@localdisk
Created October 12, 2018 02:27
Show Gist options
  • Save localdisk/9d4376a6681f232027ccfb89f416e514 to your computer and use it in GitHub Desktop.
Save localdisk/9d4376a6681f232027ccfb89f416e514 to your computer and use it in GitHub Desktop.
DevelopServiceProvider
<?php
namespace Yaranaio\Providers;
use Barryvdh\Debugbar\Facade;
use Barryvdh\Debugbar\ServiceProvider as DebugbarServiceProvider;
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
class DevelopServiceProvider extends ServiceProvider
{
/**
* @var array
*/
protected $providers = [
IdeHelperServiceProvider::class,
DebugbarServiceProvider::class,
];
/**
* @var array
*/
protected $facadeAliases = [
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') {
$this->registerServiceProviders();
$this->registerFacadeAliases();
}
}
/**
* register service providers
*/
protected function registerServiceProviders()
{
foreach ($this->providers as $provider) {
$this->app->register($provider);
}
}
/**
* add class aliases
*/
protected function registerFacadeAliases()
{
$loader = AliasLoader::getInstance();
foreach ($this->facadeAliases 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