/** * Get Route objects in an array. * * @return mixed */ public function getRoutes() { if (!is_null($this->router->getRoutes())) { return $this->router->getRoutes()->getRoutes(); } return null; }
/** * Bootstrap any application services. * * @param \Illuminate\Contracts\Routing\Registrar $router * @return void */ public function boot(Registrar $router) { $this->setRootControllerNamespace(); if ($this->app->routesAreCached()) { $this->loadCachedRoutes(); } else { $this->loadRoutes(); $this->app->booted(function () use($router) { $router->getRoutes()->refreshNameLookups(); }); } }
public function getSynchronize(Registrar $router) { $routes = $router->getRoutes(); foreach ($routes->getRoutes() as $controller) { $actions = $controller->getAction(); if (!empty($actions['controller'])) { $service = $actions['controller']; $serviceObject = $this->model->getByAction($service); if ($serviceObject->isEmpty()) { $model = new $this->model(); $model->action = $service; $model->save(); } } } return redirect()->back(); }