loadViewsFrom(__DIR__ . '/../../resources/views', 'role'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'role'); // 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->registerRole(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerRole() { $this->app->bind('role', function($app) { return new Role($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('Role', 'Lavalite\Role\Facades\Role'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('project.role', function ($app) { return $this->app->make('Project\Role\Role'); }); // Bind Workflow to repository $this->app->bind( 'Project\Role\Interfaces\WorkflowRepositoryInterface', \Project\Role\Repositories\Eloquent\WorkflowRepository::class ); // Bind Role to repository $this->app->bind( 'Project\Role\Interfaces\RoleRepositoryInterface', \Project\Role\Repositories\Eloquent\RoleRepository::class ); // Bind Permission to repository $this->app->bind( 'Project\Role\Interfaces\PermissionRepositoryInterface', \Project\Role\Repositories\Eloquent\PermissionRepository::class ); // Bind Label to repository $this->app->bind( 'Project\Role\Interfaces\LabelRepositoryInterface', \Project\Role\Repositories\Eloquent\LabelRepository::class ); $this->app->register(\Project\Role\Providers\AuthServiceProvider::class); $this->app->register(\Project\Role\Providers\RouteServiceProvider::class); } /** * Merges user's and role's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/config.php', 'project.role' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakeRole::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['project.role']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('project/role.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/role')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/role')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }