loadViewsFrom(__DIR__ . '/../../resources/views', 'company_structure'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'company_structure'); // 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->registerCompanyStructure(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerCompanyStructure() { $this->app->bind('company_structure', function($app) { return new CompanyStructure($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('CompanyStructure', 'Lavalite\CompanyStructure\Facades\CompanyStructure'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('company.company_structure', function ($app) { return $this->app->make('Company\CompanyStructure\CompanyStructure'); }); // Bind Hall to repository $this->app->bind( 'Company\CompanyStructure\Interfaces\HallRepositoryInterface', \Company\CompanyStructure\Repositories\Eloquent\HallRepository::class ); // Bind Line to repository $this->app->bind( 'Company\CompanyStructure\Interfaces\LineRepositoryInterface', \Company\CompanyStructure\Repositories\Eloquent\LineRepository::class ); // Bind Equipment to repository $this->app->bind( 'Company\CompanyStructure\Interfaces\EquipmentRepositoryInterface', \Company\CompanyStructure\Repositories\Eloquent\EquipmentRepository::class ); // Bind Department to repository $this->app->bind( 'Company\CompanyStructure\Interfaces\DepartmentRepositoryInterface', \Company\CompanyStructure\Repositories\Eloquent\DepartmentRepository::class ); // Bind Employees to repository $this->app->bind( 'Company\CompanyStructure\Interfaces\EmployeesRepositoryInterface', \Company\CompanyStructure\Repositories\Eloquent\EmployeesRepository::class ); // Bind DepartmentRole to repository $this->app->bind( 'Company\CompanyStructure\Interfaces\DepartmentRoleRepositoryInterface', \Company\CompanyStructure\Repositories\Eloquent\DepartmentRoleRepository::class ); $this->app->register(\Company\CompanyStructure\Providers\AuthServiceProvider::class); $this->app->register(\Company\CompanyStructure\Providers\EventServiceProvider::class); $this->app->register(\Company\CompanyStructure\Providers\RouteServiceProvider::class); $this->app->register(\Company\CompanyStructure\Providers\WorkflowServiceProvider::class); } /** * Merges user's and company_structure's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/company_structure.php', 'company_structure' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakeCompanyStructure::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['company.company_structure']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('company/company_structure.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/company_structure')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/company_structure')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }