Repository URL to install this package:
|
Version:
0.1.0 ▾
|
<?php namespace Modules\Media\Providers;
use Illuminate\Support\ServiceProvider;
class MediaServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Boot the application events.
*
* @return void
*/
public function boot()
{
$this->registerConfig();
$this->registerTranslations();
$this->registerViews();
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
// User Repository
$this->app->bind('Modules\Media\Contracts\Repositories\MediaRepository',
'Modules\Media\Repositories\Eloquent\MediaRepositoryEloquent');
}
/**
* Register config.
*
* @return void
*/
protected function registerConfig()
{
$this->publishes([
__DIR__.'/../Config/config.php' => config_path('media.php'),
]);
$this->mergeConfigFrom(
__DIR__.'/../Config/config.php', 'media'
);
}
/**
* Register translations.
*
* @return void
*/
public function registerTranslations()
{
$langPath = base_path('resources/lang/modules/media');
if (!is_dir($langPath)) {
$langPath = __DIR__ .'/../Resources/lang';
}
$this->loadTranslationsFrom($langPath, 'base');
$this->loadTranslationsFrom($langPath, 'media');
}
/**
* Register views.
*
* @return void
*/
public function registerViews()
{
$viewPath = base_path('resources/views/modules/media');
$sourcePath = __DIR__.'/../Resources/views';
$this->publishes([
$sourcePath => $viewPath
]);
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . '/modules/media';
}, \Config::get('view.paths')), [$sourcePath]), 'media');
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array();
}
}