/** * Define the routes for the application. * * @param \Illuminate\Routing\Router $router * @return void */ public function map(Router $router) { // Module routes. $modules = new \Ormic\Modules(); foreach ($modules->getAll() as $mod) { require app_path() . '/../' . $mod . '/Http/routes.php'; } // Core application routes. $router->group(['namespace' => $this->namespace], function ($router) { require app_path('Http/routes.php'); }); }
/** * Register any application services. * * This service provider is a great spot to register your various container * bindings with the application. As you can see, we are registering our * "Registrar" implementation here. You can add your own bindings too! * * @return void */ public function register() { $this->app->bind('Illuminate\\Contracts\\Auth\\Registrar', 'Ormic\\Services\\Registrar'); $modules = new \Ormic\Modules(); foreach ($modules->getAll() as $name => $path) { $modServiceProvider = 'Ormic\\modules\\' . $name . '\\Providers\\' . studly_case($name) . 'ServiceProvider'; if (class_exists($modServiceProvider)) { $this->app->register($modServiceProvider); } $viewDir = app_path() . '/../' . $path . '/resources/views'; $this->loadViewsFrom($viewDir, snake_case($name)); } }
/** * Execute the console command. * * @return mixed */ public function fire() { $this->call('down'); $this->info("Upgrading core application."); $this->call('migrate'); $modules = new \Ormic\Modules(); foreach ($modules->getAll() as $name => $path) { $this->info("Upgrading {$name} module."); $dbPath = $path . '/database/migrations'; $this->call('migrate', array('--path' => $dbPath)); } $this->call('up'); }
public function __construct(Application $app, Dispatcher $events) { parent::__construct($app, $events); $fs = new Filesystem(); $modules = new \Ormic\Modules(); foreach ($modules->getAll() as $name => $path) { $commandsDir = app_path() . '/../' . $path . '/Console/Commands'; $commandFiles = $fs->files($commandsDir); foreach ($commandFiles as $commandFile) { $command = substr(basename($commandFile), 0, -4); $this->commands[] = "Ormic\\modules\\{$name}\\Console\\Commands\\{$command}"; } } }