当前位置: 首页>>代码示例>>PHP>>正文


PHP Route::getRoutes方法代码示例

本文整理汇总了PHP中Route::getRoutes方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::getRoutes方法的具体用法?PHP Route::getRoutes怎么用?PHP Route::getRoutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Route的用法示例。


在下文中一共展示了Route::getRoutes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAllRoutesHaveAuthorization

 /**
  * Tests that the authorization method is attached to all routes except for the / and /home
  *
  */
 public function testAllRoutesHaveAuthorization()
 {
     $routesArr = Route::getRoutes();
     //get all routes
     foreach ($routesArr as $route) {
         $path = $route->getPath();
         // Log::info('testing route ' . $path);
         $vals = array_values($route->middleware());
         $found = false;
         foreach ($vals as $index => $el) {
             if (FALSE !== strpos($el, "auth")) {
                 $found = true;
                 break;
             }
         }
         /**
                     Temporary hack to handle resource routes until we finish the api
                      *
                      **/
         if (starts_with($route->getPath(), "api")) {
             $found = true;
         }
         if ('/' === $path || 'home' === $path || 'index.php' === $path || 'mainlogin' === $path || 'register' === $path || 'login' === $path || 'forgotpassword' === $path) {
             $this->assertFalse($found);
         } else {
             $this->assertTrue($found, 'Route: ' . $route->getPath() . ' doesn\'t have the Authorize middleware attached (keyword \'auth\' not found in middleware array)');
         }
     }
 }
开发者ID:northdpole,项目名称:laravelTest,代码行数:33,代码来源:AuthorizationControllerTest.php

示例2: testIsInValidGenerateRoute

 public function testIsInValidGenerateRoute()
 {
     $invalidRoute = 'generate';
     $routeCollection = Route::getRoutes();
     $isValidRoute = $this->generator->checkRouteIsValid($invalidRoute, $routeCollection);
     $this->assertFalse($isValidRoute);
 }
开发者ID:phpcmsapp,项目名称:static-generator,代码行数:7,代码来源:TestStaticGenerator.php

示例3: getRoutes

 /**
  * Print all available routes
  * http://localhost/debug/routes
  *
  * @return String
  */
 public function getRoutes()
 {
     $routeCollection = Route::getRoutes();
     foreach ($routeCollection as $value) {
         echo "<a href='/" . $value->getPath() . "' target='_blank'>" . $value->getPath() . "</a><br>";
     }
 }
开发者ID:rebekahheacock,项目名称:dwa15-archive,代码行数:13,代码来源:DebugController.php

示例4: returnRoute

 public static function returnRoute($data)
 {
     if (!isset(Route::getRoutes()[$data[0]])) {
         return App::getBase();
     }
     $route = Route::getRoutes()[$data[0]];
     $data = array_slice($data, 1);
     if (!$route['rules']) {
         $url = $route['url'];
         return App::getBase() . implode('/', $url);
     } else {
         $url = [];
         foreach ($route['rules'] as $int => $rule) {
             if (!isset($data[$int])) {
                 continue;
             }
             $rule = $route['url'][$int + 1];
             $match = $route['rules'][$int];
             if ($rule == '(.*)') {
                 if (!preg_match("/({$match})/", $data[$int])) {
                     continue;
                 }
                 $url[] = $data[$int];
             } else {
                 $url[] = $data[$int];
             }
         }
         if (count($url)) {
             array_unshift($url, $route['url'][0]);
             $url = implode('/', $url);
             return App::getBase() . $url;
         }
     }
     return App::getBase();
 }
开发者ID:tadeubarbosa,项目名称:teed-php-frame,代码行数:35,代码来源:Url.php

示例5: GET_createGroupForm

 public function GET_createGroupForm()
 {
     $theme = Theme::uses('notebook')->layout('main');
     $theme->setMenu('user.group');
     $routeCollection = Route::getRoutes();
     $params = array('routes' => $routeCollection);
     return $theme->scope('user.group-create', $params)->render();
 }
开发者ID:kayrules,项目名称:laravel-starter,代码行数:8,代码来源:GroupController.php

示例6: getAllExisting

 protected function getAllExisting()
 {
     try {
         return Route::getRoutes($this->agency, TableUpdate::getLiveVersion());
     } catch (Exception $ex) {
         return false;
     }
 }
开发者ID:nikhilpatel1989,项目名称:Transporter-Server,代码行数:8,代码来源:RouteUpdate.php

示例7: __construct

 public function __construct()
 {
     foreach (\Route::getRoutes() as $route) {
         $action = is_string($route->getAction()['uses']) ? $route->getAction()['uses'] : 'Closure';
         $name = isset($route->getAction()['as']) ? $route->getAction()['as'] : '';
         $this->routes[] = ['method' => implode('|', $route->getMethods()), 'name' => $name, 'action' => $action, 'uri' => $route->getUri(), 'middleware' => isset($route->getAction()['middleware']) && is_array($route->getAction()['middleware']) ? implode(',', $route->getAction()['middleware']) : (isset($route->getAction()['middleware']) ? $route->getAction()['middleware'] : '')];
     }
 }
开发者ID:lsrur,项目名称:inspector,代码行数:8,代码来源:RoutesCollector.php

示例8: link_to_route

/**
 * Generate a HTML link to a named route.
 *
 * @param  string  $name
 * @param  string  $title
 * @param  array   $parameters
 * @param  array   $attributes
 * @return string
 */
function link_to_route($name, $title = null, $parameters = array(), $attributes = array())
{
    if (Route::getRoutes()->hasNamedRoute($name)) {
        return app('html')->linkRoute($name, $title, $parameters, $attributes);
    } else {
        return '<a href="javascript:void(0)"' . HTML::attributes($attributes) . '>' . $name . '</a>';
    }
}
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:17,代码来源:functions.php

示例9: testAllDisplayPages

 /**
  * Testing all routes
  *
  * @return void
  */
 public function testAllDisplayPages()
 {
     $user = User::find(2);
     $results = [];
     foreach (Route::getRoutes() as $route) {
         $this->actingAs($user)->withSession(['foo' => 'bar'])->visit($route->uri());
         //$response = $this->call('GET', $route->uri());
         //$this->assertEquals(200, $response->getStatusCode(), $route->uri() . " " . $response);
     }
 }
开发者ID:skinuxgeek,项目名称:NewsWise,代码行数:15,代码来源:SiteTest.php

示例10: getSlugsInvalid

 public function getSlugsInvalid()
 {
     $list = array();
     foreach (\Route::getRoutes() as $route) {
         $temp = explode('/', $route->getPath());
         if (trim($temp[0])) {
             $list[] = $temp[0];
         }
     }
     return array_unique($list);
 }
开发者ID:bbig979,项目名称:shoppyst,代码行数:11,代码来源:UserRepositoryEloquent.php

示例11: steps

 /**
  * Get all the installer steps
  *
  * @return array
  */
 function steps()
 {
     $steps = [];
     foreach (Route::getRoutes() as $route) {
         $route_name = $route->getName();
         if (str_contains($route_name, 'admin.installer')) {
             $steps[] = $route_name;
         }
     }
     return $steps;
 }
开发者ID:huludini,项目名称:aura-kingdom-web,代码行数:16,代码来源:helpers.php

示例12: getRouteActions

 /**
  * returns all registered route action name
  *
  * @return array
  */
 public function getRouteActions()
 {
     $return = [];
     foreach (\Route::getRoutes() as $route) {
         $actionNameExplode = explode("\\", $route->getActionName());
         end($actionNameExplode);
         $actionName = $actionNameExplode[key($actionNameExplode)];
         $return[] = $actionName;
     }
     return $return;
 }
开发者ID:ramonchristophermorales,项目名称:profile-roles,代码行数:16,代码来源:PR.php

示例13: getRoutes

 public static function getRoutes()
 {
     $routeCollection = \Route::getRoutes();
     foreach ($routeCollection as $value) {
         if ($value->getActionName() != "Closure") {
             $data['data']['method'][] = $value->getMethods()[0];
             $data['data']['path'][] = $value->getPath();
             $data['data']['action'][] = $value->getActionName();
         }
     }
     return $data;
 }
开发者ID:anggagewor,项目名称:Labs,代码行数:12,代码来源:RoutesModel.php

示例14: getData

 /**
  * @return mixed get the data to be serialized
  */
 public function getData()
 {
     $data = array('currentRoute' => \Route::getCurrentRoute());
     $base_path = Request::root();
     $routes = \Route::getRoutes()->all();
     $results = array();
     foreach ($routes as $name => $route) {
         $results[] = $this->getRouteInformation($name, $route, $data['currentRoute'], $base_path);
     }
     $data['routes'] = $results;
     return array('router' => $data);
 }
开发者ID:onigoetz,项目名称:profiler,代码行数:15,代码来源:RouterDataCollector.php

示例15: createForm

 private function createForm()
 {
     $this->addPanel('Dados do grupo de usuário', function ($panel) {
         $panel->addText('name', 'Nome do grupo');
         $panel->addCheckboxActive('status', 'Status')->width = 6;
         $panel->addCheckbox('super_administrator', 'Super Administrador')->width = 6;
     });
     $this->addPanel('Descrição do grupo', function ($panel) {
         $panel->addTextArea('description', 'Descrição')->addAttribute('style', 'height: 118px;');
     });
     $this->addPanel('Permissões de acesso', function ($panel) {
         $permissions = [];
         $ignore_routes = config('bw.middleware.aclroutes.ignore_routes', []);
         foreach (\Route::getRoutes() as $route) {
             if ($route->getName()) {
                 if (!in_array($route->getName(), $ignore_routes)) {
                     $name = 'route::' . $route->getName();
                     if (isset($route->getAction()['middleware'])) {
                         if (in_array('bw.aclroutes', $route->getAction()['middleware'])) {
                             $url = str_replace('.', '/', str_replace('route::bw.', '/', $name));
                             $permissions[$name] = ['label' => $url, 'value' => $name, 'checked' => ''];
                         }
                     }
                 }
             }
         }
         //
         if (count(old())) {
             foreach (old('permissions', []) as $i) {
                 $permissions[$i]['checked'] = 'checked';
             }
         } else {
             if ($this->model) {
                 $erros = [];
                 foreach ($this->model->permissions as $i) {
                     if (isset($permissions[$i->permission])) {
                         $permissions[$i->permission]['checked'] = 'checked';
                     } else {
                         $erros[] = '- ' . $i->permission;
                     }
                 }
                 if (count($erros)) {
                     $msg = 'As seguinte permissões não existem mais e serão removidas ao salvar o grupo<br><br>' . join('<br>', $erros);
                     app('flash')->warning($msg);
                 }
             }
         }
         //
         $panel->width = 12;
         $panel->addIncludeFile('BW::users.groups.permissions', $permissions);
     });
     return $this;
 }
开发者ID:eliasrosa,项目名称:bw-core,代码行数:53,代码来源:UserGroupForm.php


注:本文中的Route::getRoutes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。