doujuanju3076 2016-06-26 15:05 采纳率: 0%
浏览 71
已采纳

表单验证'dimensions'抛出BadMethodCallException

I'm developing a web application in Laravel 5.2.22 and I'm running into a problem with form validation.

I want to validate the dimensions of user uploaded avatars with the 'dimensions' validation rule. This is how I configured it in my rules() array: 'profile_image' => 'image|dimensions:min_width=360,min_height=360'. When I submit the form though, I get this error:

BadMethodCallException in Validator.php line 2950:
Method [validateDimensions] does not exist.
in Validator.php line 2950
at Validator->__call('validateDimensions', array('profile_image', 'avatar.jpg', array('min_width=360', 'min_height=360'), object(Validator))) in Validator.php line 416
at Validator->validateDimensions('profile_image', 'avatar.jpg', array('min_width=360', 'min_height=360'), object(Validator)) in Validator.php line 416

Any ideas why this happens?

  • 写回答

1条回答 默认 最新

  • duanlangwen9597 2016-06-26 17:30
    关注

    I don't know why @Derp deleted their post, but they're exactly right.

    You're running 5.2.2 which does not have the dimensions validation rule. That was introduced in version 5.2.32 on 2016-05-17

    Simply upgrade your Laravel installation.

    Also, as Laravel 5.2 is not the LTS version, be aware changes happen all the time, so you should consider updating every day.

    Here's a changelog you can watch so you can compare new features of new minor releases.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算