/** * Get the route information for a given route. * * @param string $name * @param Route $route * @param Route $current the current route * @param string $base_path * @return array */ protected function getRouteInformation($name, Route $route, $current, $base_path) { $path = $route->getPath(); $uri = head($route->getMethods()) . ' <a href="' . $base_path . $path . '">' . $path . '</a>'; $action = $route->getAction() ?: 'Closure'; return array('current' => $current == $route, 'host' => $route->getHost(), 'uri' => $uri, 'name' => $this->getRouteName($name), 'action' => $action, 'before' => $this->getBeforeFilters($route), 'after' => $this->getAfterFilters($route)); }
protected function preparePath() { $path = $this->route->getPath(); if ($path === '/') { return $path; } return trim($path, '/'); }
/** * Get all of the pattern filters matching the route. * * @param \Illuminate\Routing\Route $route * @return array */ protected function getPatternFilters($route) { $patterns = array(); foreach ($route->getMethods() as $method) { $inner = $this->router->findPatternFilters($method, $route->getPath()); $patterns = array_merge($patterns, $inner); } return $patterns; }
private function generateTableRow(Route $route) { $tableRow = ""; $tableRow .= '<tr>'; $tableRow .= '<td>' . $route->getName() . '</td>'; $tableRow .= '<td><a href="' . $this->appUrl . '/' . $route->getUri() . '" target="_blank">' . $this->appUrl . '/' . $route->getPath() . '</a></td>'; $tableRow .= '</tr>'; return $tableRow; }
/** * Create a new exception for missing route parameters. * * @param \Illuminate\Routing\Route $route * @return static */ public static function forMissingParameters($route) { return new static("Missing required parameters for [Route: {$route->getName()}] [URI: {$route->getPath()}]."); }
/** * @param Route $route * @param string $httpMethod * @return string */ protected static function getPermissionKey(Route $route, $httpMethod) { // return str_pad($httpMethod, 6, ' ') . ' -> /' . ltrim($route->getPath(), '/'); return $httpMethod . '->' . $route->getPath(); }
/** * @param Route $route * @param EntrustUserInterface $user * @return bool */ public function checkPermission(Route $route, EntrustUserInterface $user) { $action = $route->getName() ?: $route->getPath(); return $this->canAccess($action, $user); }