loadViewsFrom(__DIR__ . '/../../resources/views', 'referrer'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'referrer'); // Load migrations $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); // Call pblish redources function $this->publishResources(); } /** * Register the service provider. * * @return void */ public function register() { $this->mergeConfig(); $this->registerReferrer(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerReferrer() { $this->app->bind('referrer', function($app) { return new Referrer($app); }); } /** * Register the vault facade without the user having to add it to the app.php file. * * @return void */ public function registerFacade() { $this->app->booting(function() { $loader = \Illuminate\Foundation\AliasLoader::getInstance(); $loader->alias('Referrer', 'Lavalite\Referrer\Facades\Referrer'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('litecms.referrer', function ($app) { return $this->app->make('Litecms\Referrer\Referrer'); }); // Bind User to repository $this->app->bind( 'Litecms\Referrer\Interfaces\UserRepositoryInterface', \Litecms\Referrer\Repositories\Eloquent\UserRepository::class ); $this->app->register(\Litecms\Referrer\Providers\AuthServiceProvider::class); $this->app->register(\Litecms\Referrer\Providers\EventServiceProvider::class); $this->app->register(\Litecms\Referrer\Providers\RouteServiceProvider::class); } /** * Merges user's and referrer's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/referrer.php', 'referrer' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakeReferrer::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['litecms.referrer']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('litecms/referrer.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/referrer')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/referrer')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }