loadViewsFrom(__DIR__ . '/../../resources/views', 'advancedcrm'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'advancedcrm'); // 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->registerAdvancedcrm(); $this->registerFacade(); $this->registerBindings(); //$this->registerCommands(); } /** * Register the application bindings. * * @return void */ protected function registerAdvancedcrm() { $this->app->bind('advancedcrm', function($app) { return new Advancedcrm($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('Advancedcrm', 'Lavalite\Advancedcrm\Facades\Advancedcrm'); }); } /** * Register bindings for the provider. * * @return void */ public function registerBindings() { // Bind facade $this->app->bind('cleancrm.advancedcrm', function ($app) { return $this->app->make('Cleancrm\Advancedcrm\Advancedcrm'); }); // Bind Company to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\CompanyRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\CompanyRepository::class ); // Bind Calendar to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\CalendarRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\CalendarRepository::class ); // Bind CalendarEvent to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\CalendarEventRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\CalendarEventRepository::class ); // Bind CalendarEventStatus to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\CalendarEventStatusRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\CalendarEventStatusRepository::class ); // Bind CalendarEventPriority to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\CalendarEventPriorityRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\CalendarEventPriorityRepository::class ); // Bind Relation to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\RelationRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\RelationRepository::class ); // Bind RelationType to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\RelationTypeRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\RelationTypeRepository::class ); // Bind RelationStatus to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\RelationStatusRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\RelationStatusRepository::class ); // Bind Lead to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\LeadRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\LeadRepository::class ); // Bind CrmLeadstatus to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\CrmLeadstatusRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\CrmLeadstatusRepository::class ); // Bind LeadSource to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\LeadSourceRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\LeadSourceRepository::class ); // Bind Opportunity to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\OpportunityRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\OpportunityRepository::class ); // Bind OpportunityStatus to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\OpportunityStatusRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\OpportunityStatusRepository::class ); // Bind Vendor to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\VendorRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\VendorRepository::class ); // Bind Customer to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\CustomerRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\CustomerRepository::class ); // Bind RelationAddress to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\RelationAddressRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\RelationAddressRepository::class ); // Bind RelationCommunication to repository $this->app->bind( 'Cleancrm\Advancedcrm\Interfaces\RelationCommunicationRepositoryInterface', \Cleancrm\Advancedcrm\Repositories\Eloquent\RelationCommunicationRepository::class ); $this->app->register(\Cleancrm\Advancedcrm\Providers\AuthServiceProvider::class); $this->app->register(\Cleancrm\Advancedcrm\Providers\EventServiceProvider::class); $this->app->register(\Cleancrm\Advancedcrm\Providers\RouteServiceProvider::class); $this->app->register(\Cleancrm\Advancedcrm\Providers\WorkflowServiceProvider::class); } /** * Merges user's and advancedcrm's configs. * * @return void */ protected function mergeConfig() { $this->mergeConfigFrom( __DIR__ . '/../../config/advancedcrm.php', 'advancedcrm' ); } /** * Register scaffolding command */ protected function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ Commands\MakeAdvancedcrm::class, ]); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['cleancrm.advancedcrm']; } /** * Publish resources. * * @return void */ private function publishResources() { // Publish configuration file $this->publishes([__DIR__ . '/../../config/config.php' => config_path('cleancrm/advancedcrm.php')], 'config'); // Publish admin view $this->publishes([__DIR__ . '/../../resources/views' => base_path('resources/views/vendor/advancedcrm')], 'view'); // Publish language files $this->publishes([__DIR__ . '/../../resources/lang' => base_path('resources/lang/vendor/advancedcrm')], 'lang'); // Publish public files and assets. $this->publishes([__DIR__ . '/public/' => public_path('/')], 'public'); } }