https://learnku.com/docs/laravel/5.8
源码路径 vendor\laravel\framework\src\Illuminate\Routing\Router.php
搜索 public function #各种方法不说了
https://learnku.com/docs/laravel/5.8/routing/3890 官方文档
源码路径 vendor\laravel\framework\src\Illuminate\Routing\Router.php
protected $allowedAttributes = [ 'as', 'domain', 'middleware', 'name', 'namespace', 'prefix', 'where', ];
//以上方法的属性的调用
public function __call($method, $parameters)
{
if (in_array($method, $this->passthru)) {
return $this->registerRoute($method, ...$parameters);
}
if (in_array($method, $this->allowedAttributes)) {
if ($method === 'middleware') {
return $this->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters);
}
return $this->attribute($method, $parameters[0]);
}
throw new BadMethodCallException(sprintf(
'Method %s::%s does not exist.', static::class, $method
));
}