loadViewsFrom(__DIR__ . '/../../resources/views', 'pm'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'pm'); // 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->registerPm(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerPm() { $this->app->bind('pm', function($app) { return new Pm($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('Pm', 'Lavalite\Pm\Facades\Pm'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('project.pm', function ($app) { return $this->app->make('Project\Pm\Pm'); }); // Bind Comment to repository $this->app->bind( 'Project\Pm\Interfaces\CommentRepositoryInterface', \Project\Pm\Repositories\Eloquent\CommentRepository::class ); // Bind Page to repository $this->app->bind( 'Project\Pm\Interfaces\PageRepositoryInterface', \Project\Pm\Repositories\Eloquent\PageRepository::class ); // Bind Project to repository $this->app->bind( 'Project\Pm\Interfaces\ProjectRepositoryInterface', \Project\Pm\Repositories\Eloquent\ProjectRepository::class ); // Bind Roadmap to repository $this->app->bind( 'Project\Pm\Interfaces\RoadmapRepositoryInterface', \Project\Pm\Repositories\Eloquent\RoadmapRepository::class ); // Bind Sprint to repository $this->app->bind( 'Project\Pm\Interfaces\SprintRepositoryInterface', \Project\Pm\Repositories\Eloquent\SprintRepository::class ); // Bind Worklog to repository $this->app->bind( 'Project\Pm\Interfaces\WorklogRepositoryInterface', \Project\Pm\Repositories\Eloquent\WorklogRepository::class ); $this->app->register(\Project\Pm\Providers\AuthServiceProvider::class); $this->app->register(\Project\Pm\Providers\RouteServiceProvider::class); } /** * Merges user's and pm's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/config.php', 'project.pm' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakePm::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['project.pm']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('project/pm.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/pm')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/pm')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }