本文整理汇总了PHP中Illuminate\Routing\Route::getCompiled方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::getCompiled方法的具体用法?PHP Route::getCompiled怎么用?PHP Route::getCompiled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Route
的用法示例。
在下文中一共展示了Route::getCompiled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: matches
/**
* Validate a given rule against a route and request.
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
* @return bool
*/
public function matches(Route $route, Request $request)
{
if (is_null($route->getCompiled()->getHostRegex())) {
return true;
}
return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
}
示例2: matches
/**
* Validate a given rule against a route and request.
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
*
* @return bool
*/
public function matches(Route $route, Request $request)
{
$regex = $route->getCompiled()->getRegex();
if (str_contains($request->getRequestUri(), '/wp-admin')) {
return preg_match(str_replace('$#s', '(?:&.+)?$#s', $regex), rawurldecode($request->getRequestUri()));
}
$path = $request->path() == '/' ? '/' : '/' . $request->path();
return preg_match($regex, rawurldecode($path));
}
示例3: matches
/**
* Validate a given rule against a route and request.
*
* @param LaravelRoute $route illuminate route
* @param LaravelRequest $request illuminate request
*
* @return bool
*/
public function matches(Route $route, Request $request)
{
$path = $request->path() == '/' ? '/' : '/' . $request->path();
$firstSegment = $request->segment(1);
if ($firstSegment === null) {
return true;
} else {
return preg_match($route->getCompiled()->getRegex(), rawurldecode($path));
}
}
示例4: matches
public function matches(Route $route, Request $request)
{
$path = $request->path() == '/' ? '/' : '/' . $request->path();
return preg_match($route->getCompiled()->getRegex(), rawurldecode($path));
}
示例5: canReview
/**
* canReview
*
* @param Route $route laravel route
* @param Request $request laravel request
*
* @return bool
*/
private function canReview(Route $route, Request $request)
{
if (!is_null($route->getCompiled()->getHostRegex())) {
return false;
}
$firstSegment = $request->segment(1);
if ($firstSegment === null) {
return true;
}
$uri = $route->uri();
if (strpos($uri, '{') === false) {
return false;
}
$actions = $route->getAction();
if (isset($actions['module'])) {
return true;
}
return false;
}
示例6: getRouteIdentity
/**
* Transform route into string route identity
*
* @param Illuminate\Routing\Route $route
* @return string formatted '<route_methods> <route_regex>'
*/
protected function getRouteIdentity(Route $route)
{
$route->bind($this->app['request']);
$regex = $route->getCompiled()->getRegex();
$methods = implode('|', $route->getMethods());
return $methods . ' ' . $regex;
}