fetchByModule() public method

Retrieve routes by module name
public fetchByModule ( string $module ) : InstanceRoute[]
$module string module name
return InstanceRoute[]
Exemplo n.º 1
0
 /**
  * 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];
 }
Exemplo n.º 2
0
 /**
  * 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'));
 }