loadViewsFrom(__DIR__ . '/../../resources/views', 'projects'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'projects'); // 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->registerProjects(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerProjects() { $this->app->bind('projects', function($app) { return new Projects($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('Projects', 'Lavalite\Projects\Facades\Projects'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('annie.projects', function ($app) { return $this->app->make('Annie\Projects\Projects'); }); // Bind Project to repository $this->app->bind( 'Annie\Projects\Interfaces\ProjectRepositoryInterface', \Annie\Projects\Repositories\Eloquent\ProjectRepository::class ); // Bind ProjectItem to repository $this->app->bind( 'Annie\Projects\Interfaces\ProjectItemRepositoryInterface', \Annie\Projects\Repositories\Eloquent\ProjectItemRepository::class ); // Bind ProjectKindSupport to repository $this->app->bind( 'Annie\Projects\Interfaces\ProjectKindSupportRepositoryInterface', \Annie\Projects\Repositories\Eloquent\ProjectKindSupportRepository::class ); $this->app->register(\Annie\Projects\Providers\AuthServiceProvider::class); $this->app->register(\Annie\Projects\Providers\RouteServiceProvider::class); } /** * Merges user's and projects's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/projects.php', 'projects' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakeProjects::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['annie.projects']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('annie/projects.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/projects')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/projects')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }