<?php
namespaceApp\Modules;/**
* ServiceProvider
*
* The service provider for the modules. After being registered
* it will make sure that each of the modules are properly loaded
* i.e. with their routes, views etc.
*
* @author kundan Roy <query@programmerlab.com>
* @package App\Modules
*/useIlluminate\Support\Facades\Route;useIlluminate\Foundation\Support\Providers\RouteServiceProvider asServiceProvider;classModulesServiceProviderextendsServiceProvider{/**
* Will make sure that the required modules have been fully loaded
* @return void routeModule
*/publicfunction boot(){// For each of the registered modules, include their routes and Views
$modules = config(“module.modules”);while(list(,$module)= each($modules)){// Load the routes for each of the modulesif(file_exists(DIR.’/’.$module.’/routes.php’)){
include DIR.’/’.$module.’/routes.php’;}if(is_dir(DIR.’/’.$module.’/Views’)){
$this->loadViewsFrom(DIR.’/’.$module.’/Views’, $module);}}}publicfunctionregister(){}}