本文整理汇总了PHP中Illuminate\Routing\Route::methods方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::methods方法的具体用法?PHP Route::methods怎么用?PHP Route::methods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Route
的用法示例。
在下文中一共展示了Route::methods方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterRouteAsClass
protected function filterRouteAsClass(Route $route)
{
if ($this->option('name') && !str_contains($route->getName(), $this->option('name')) || $this->option('path') && !str_contains(implode('|', $route->methods()) . ' ' . $route->uri(), $this->option('path'))) {
return null;
}
return $route;
}
示例2: addToCollections
/**
* Add the given route to the arrays of routes.
*
* @param \Illuminate\Routing\Route $route
* @return void
*/
protected function addToCollections($route)
{
foreach ($route->methods() as $method) {
$this->routes[$method][$route->domain() . $route->getUri()] = $route;
}
$this->allRoutes[$method . $route->domain() . $route->getUri()] = $route;
}
示例3: addToCollections
/**
* Add the given route to the arrays of routes.
*
* @param \Illuminate\Routing\Route $route
* @return void
*/
protected function addToCollections($route)
{
$domainAndUri = $route->domain() . $route->getUri() . $route->getPriority();
foreach ($route->methods() as $method) {
$this->routes[$method][$domainAndUri] = $route;
}
$this->allRoutes[$method . $domainAndUri] = $route;
}
示例4: getPatternFilters
/**
* Get all of the pattern filters matching the route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function getPatternFilters($route)
{
$patterns = array();
foreach ($route->methods() as $method) {
// For each method supported by the route we will need to gather up the patterned
// filters for that method. We will then merge these in with the other filters
// we have already gathered up then return them back out to these consumers.
$inner = $this->getMethodPatterns($route->uri(), $method);
$patterns = array_merge($patterns, array_keys($inner));
}
return $patterns;
}
示例5: isAlternate
public function isAlternate(LaravelRoute $route)
{
if (!$route instanceof Route) {
return false;
}
// Validate methods
if ($this->methods() != $route->methods()) {
return false;
}
// Validate scheme
if ($this->httpOnly() !== $route->httpOnly()) {
return false;
}
// Validate base uri
if ($this->getBaseUri() !== $route->getBaseUri()) {
return false;
}
if ($this->getUri() === $route->getUri()) {
return false;
}
return true;
}
示例6: 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)
{
return in_array($request->getMethod(), $route->methods());
}
示例7: getRouteInformation
protected function getRouteInformation(Route $route)
{
$uri = implode('|', $route->methods()) . ' ' . $route->uri();
return $this->filterRoute(['uri' => $uri, 'name' => $route->getName(), 'before' => $this->getBeforeFilters($route), 'after' => $this->getAfterFilters($route)]);
}
示例8: getRouteInformation
/**
* @param \Illuminate\Routing\Route $route
*
* @return array
*/
protected function getRouteInformation(Route $route)
{
return $this->filterRoute(['host' => $route->domain(), 'method' => implode('|', $route->methods()), 'uri' => $route->uri(), 'name' => $route->getName(), 'action' => $route->getActionName(), 'middleware' => $this->getMiddleware($route)]);
}
示例9: getRouteInformation
/**
* Get the route information for a given route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function getRouteInformation(Route $route)
{
return $this->filterRoute(array('host' => $route->domain(), 'uri' => implode('|', $route->methods()) . ' ' . $route->uri(), 'name' => $route->getName(), 'action' => $route->getActionName(), 'version' => implode(', ', array_get($route->getAction(), 'version')), 'protected' => array_get($route->getAction(), 'protected') ? 'Yes' : 'No', 'scopes' => $this->getScopes($route)));
}
示例10: getPatternFilters
/**
* Get all of the pattern filters matching the route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function getPatternFilters($route)
{
$patterns = [];
foreach ($route->methods() as $method) {
$inner = $this->getMethodPatterns($route->uri(), $method);
$patterns = array_merge($patterns, array_keys($inner));
}
return $patterns;
}
示例11: getRouteInformation
/**
* Get the route information for a given route.
*
* @param string $name
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function getRouteInformation(Route $route)
{
$uri = implode('|', $route->methods()) . ' ' . $route->uri();
return $this->filterRoute(array('host' => $route->domain(), 'uri' => $uri, 'name' => $route->getName(), 'action' => $route->getActionName(), 'prefix' => $route->getPrefix(), 'method' => $route->methods()[0]));
}
示例12: getRouteInformation
/**
* @param Route $route
*
* @return array
*/
protected function getRouteInformation(Route $route)
{
return ['method' => implode('|', $route->methods()), 'uri' => $route->uri(), 'name' => $route->getName(), 'action' => $route->getActionName()];
}
示例13: getRouteMethod
private function getRouteMethod(Route $route)
{
$methods = $route->methods();
return Arr::first($methods);
}
示例14: getRouteInformation
/**
* Get the route information for a given route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function getRouteInformation(Route $route)
{
return $this->filterRoute(['uri' => $route->uri(), 'methods' => $route->methods(), 'name' => $route->getName(), 'action' => $route->getActionName()]);
}