예제 #1
0
 public function test()
 {
     $request = Request::instance();
     $uri = 'demo/test/{param1?}/{param2?}/{param3?}/{slug?}';
     //
     $route = new Route('GET', $uri, function () {
         echo 'Hello, World!';
     });
     $route->where('slug', '(.*)');
     // Match the Route.
     if ($route->matches($request)) {
         $route->bind($request);
         $content = '<pre>Route matched!</pre>';
     } else {
         $content = '<pre>Route not matched!</pre>';
     }
     $content .= '<pre>' . htmlspecialchars(var_export($route, true)) . '</pre>';
     return View::make('Default')->shares('title', __d('demos', 'Test'))->with('content', $content);
 }
예제 #2
0
 /**
  * Add the necessary where clauses to the route based on its initial registration.
  *
  * @param  \Nova\Routing\Route  $route
  * @return \Nova\Routing\Route
  */
 protected function addWhereClausesToRoute($route)
 {
     $route->where(array_merge($this->patterns, array_get($route->getAction(), 'where', [])));
     return $route;
 }