验证手机号码问题
0

        'mobile'     => 'required|phone:CN,mobile',

{

    "message": "Ambiguous phone validation parameter: \"mobile\". This parameter is recognized as an input field and as a phone type. Please rename the input field.",

    "exception": "Propaganistas\LaravelPhone\Exceptions\InvalidParameterException",

    "file": "/Users/wangqinfeng/ctsy/trunk/vendor/propaganistas/laravel-phone/src/Exceptions/InvalidParameterException.php",

    "line": 15,

    "trace": [

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/propaganistas/laravel-phone/src/Validation/Phone.php",

            "line": 116,

            "function": "ambiguous",

            "class": "Propaganistas\LaravelPhone\Exceptions\InvalidParameterException",

            "type": "::"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/propaganistas/laravel-phone/src/Validation/Phone.php",

            "line": 47,

            "function": "extractParameters",

            "class": "Propaganistas\LaravelPhone\Validation\Phone",

            "type": "->"

        },

        {

            "function": "validate",

            "class": "Propaganistas\LaravelPhone\Validation\Phone",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Validation/Validator.php",

            "line": 1138,

            "function": "call_user_func_array"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Validation/Validator.php",

            "line": 1123,

            "function": "callClassBasedExtension",

            "class": "Illuminate\Validation\Validator",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Validation/Validator.php",

            "line": 1155,

            "function": "callExtension",

            "class": "Illuminate\Validation\Validator",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Validation/Validator.php",

            "line": 373,

            "function": "__call",

            "class": "Illuminate\Validation\Validator",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Validation/Validator.php",

            "line": 268,

            "function": "validateAttribute",

            "class": "Illuminate\Validation\Validator",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Validation/Validator.php",

            "line": 293,

            "function": "passes",

            "class": "Illuminate\Validation\Validator",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php",

            "line": 25,

            "function": "fails",

            "class": "Illuminate\Validation\Validator",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php",

            "line": 30,

            "function": "validateResolved",

            "class": "Illuminate\Foundation\Http\FormRequest",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Container/Container.php",

            "line": 1069,

            "function": "Illuminate\Foundation\Providers\{closure}",

            "class": "Illuminate\Foundation\Providers\FormRequestServiceProvider",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Container/Container.php",

            "line": 1033,

            "function": "fireCallbackArray",

            "class": "Illuminate\Container\Container",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Container/Container.php",

            "line": 1018,

            "function": "fireAfterResolvingCallbacks",

            "class": "Illuminate\Container\Container",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Container/Container.php",

            "line": 677,

            "function": "fireResolvingCallbacks",

            "class": "Illuminate\Container\Container",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Container/Container.php",

            "line": 609,

            "function": "resolve",

            "class": "Illuminate\Container\Container",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Application.php",

            "line": 733,

            "function": "make",

            "class": "Illuminate\Container\Container",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php",

            "line": 79,

            "function": "make",

            "class": "Illuminate\Foundation\Application",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php",

            "line": 46,

            "function": "transformDependency",

            "class": "Illuminate\Routing\ControllerDispatcher",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php",

            "line": 27,

            "function": "resolveMethodDependencies",

            "class": "Illuminate\Routing\ControllerDispatcher",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",

            "line": 41,

            "function": "resolveClassMethodDependencies",

            "class": "Illuminate\Routing\ControllerDispatcher",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Route.php",

            "line": 212,

            "function": "dispatch",

            "class": "Illuminate\Routing\ControllerDispatcher",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Route.php",

            "line": 169,

            "function": "runController",

            "class": "Illuminate\Routing\Route",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Router.php",

            "line": 679,

            "function": "run",

            "class": "Illuminate\Routing\Route",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 30,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Router",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/app/Http/Middleware/Auth.php",

            "line": 30,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "App\Http\Middleware\Auth",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",

            "line": 41,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\Routing\Middleware\SubstituteBindings",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php",

            "line": 75,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\Foundation\Http\Middleware\VerifyCsrfToken",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php",

            "line": 49,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\View\Middleware\ShareErrorsFromSession",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",

            "line": 63,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\Session\Middleware\StartSession",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",

            "line": 37,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",

            "line": 66,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\Cookie\Middleware\EncryptCookies",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 104,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Router.php",

            "line": 681,

            "function": "then",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Router.php",

            "line": 656,

            "function": "runRouteWithinStack",

            "class": "Illuminate\Routing\Router",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Router.php",

            "line": 622,

            "function": "runRoute",

            "class": "Illuminate\Routing\Router",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Router.php",

            "line": 611,

            "function": "dispatchToRoute",

            "class": "Illuminate\Routing\Router",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",

            "line": 176,

            "function": "dispatch",

            "class": "Illuminate\Routing\Router",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 30,

            "function": "Illuminate\Foundation\Http\{closure}",

            "class": "Illuminate\Foundation\Http\Kernel",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/fideloper/proxy/src/TrustProxies.php",

            "line": 57,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Fideloper\Proxy\TrustProxies",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",

            "line": 31,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",

            "line": 31,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",

            "line": 27,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",

            "line": 62,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 151,

            "function": "handle",

            "class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",

            "line": 53,

            "function": "Illuminate\Pipeline\{closure}",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",

            "line": 104,

            "function": "Illuminate\Routing\{closure}",

            "class": "Illuminate\Routing\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",

            "line": 151,

            "function": "then",

            "class": "Illuminate\Pipeline\Pipeline",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",

            "line": 116,

            "function": "sendRequestThroughRouter",

            "class": "Illuminate\Foundation\Http\Kernel",

            "type": "->"

        },

        {

            "file": "/Users/wangqinfeng/ctsy/trunk/public/index.php",

            "line": 55,

            "function": "handle",

            "class": "Illuminate\Foundation\Http\Kernel",

            "type": "->"

        }

    ]

}

《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 7
liyu001989

貌似是字段名称不能使用 mobile,你改个名试一下

代码在 propaganistas/laravel-phone/src/Traits/ParsesTypes.php isValidType。

4天前

@liyu001989 我知道了,是改了表单名字,但是不理解为什么。

4天前
liyu001989

看代码,貌似字段名不能与模式相同,那么可能 mobile ,fixed_line 这些都不行。不知道理解的准不准确,有兴趣可以加日志调试一下

4天前

@liyu001989 这个是Laravel的问题,还是他的问题?

3天前
liyu001989

当然是扩展包的逻辑

3天前

@liyu001989 你不给作者提提意见?

3天前
liyu001989
  1. 扩展包写了这个逻辑,并不一定是bug;
  2. 可以了解一下为什么。看看 issue 或者尝试阅读以下代码;
  3. 如果没有找到答案再提交 issue,说明具体的版本,错误和原因;

你可以尝试一下,我有空了会再看一下这个逻辑

3天前

  • 请注意单词拼写,以及中英文排版,参考此页
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`, 更多语法请见这里 Markdown 语法
  • 支持表情,使用方法请见 Emoji 自动补全来咯,可用的 Emoji 请见 :metal: :point_right: Emoji 列表 :star: :sparkles:
  • 上传图片, 支持拖拽和剪切板黏贴上传, 格式限制 - jpg, png, gif
  • 发布框支持本地存储功能,会在内容变更时保存,「提交」按钮点击时清空
  请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!