Retrieve routes by module name
public fetchByModule ( string $module ) : |
||
$module | string | module name |
리턴 |
/** * Retrieve routes by module name * * @param string $module module name * @return InstanceRoute[] */ public function fetchByModule($module) { if (!isset($this->mapByModule[$module])) { $routes = $this->repo->fetchByModule($module); foreach ($routes as $route) { $this->setToMap($route); } } return $this->mapByModule[$module]; }
/** * Retrieve routes by module name * * @param string $module module name * @return InstanceRoute[] */ public function fetchByModule($module) { $key = $this->getCacheKey($module); $routes = $this->cache->has($key) ? $this->cache->get($key) : call_user_func(function () use($module, $key) { $routes = $this->repo->fetchByModule($module); if (count($routes) > 0) { $this->cache->put($key, $routes); } return $routes; }); return $routes; }
/** * document manager * * @return \Xpressengine\Presenter\RendererInterface */ public function docsTrash(Request $request, RouteRepository $routeRepository) { $instances = []; $instanceIds = []; $urls = []; $instanceRoutes = $routeRepository->fetchByModule(BoardModule::getId()); foreach ($instanceRoutes as $route) { $instanceIds[] = $route->instanceId; $urls[$route->instanceId] = $route->url; $instances[] = ['id' => $route->instanceId, 'name' => $route->url]; } $wheres = ['status' => Board::STATUS_TRASH, 'instanceIds' => $instanceIds]; // keyword 검색 처리 if ($request->get('searchKeyword') != '') { $searchTarget = $request->get('searchTarget'); $searchKeyword = $request->get('searchKeyword'); if ($searchTarget == 'title_content') { $wheres[$searchTarget] = $searchKeyword; } else { $wheres[$searchTarget] = $searchKeyword; } } // 상세 검색 처리 foreach ($request->all() as $key => $value) { if ($value != '') { $wheres[$key] = $value; } } $query = Board::whereIn('instanceId', $instanceIds)->where('status', Board::STATUS_TRASH); $query->orderBy('createdAt', 'desc'); $documents = $query->paginate(15)->appends($request->except('page')); return $this->presenter->make('docs.trash', compact('documents', 'instances', 'urls')); }