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?
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.