Fixes issue with the validation message not being translated.

Signed-off-by: Abijeet <abijeetpatro@gmail.com>
This commit is contained in:
Abijeet 2018-03-13 09:10:23 +05:30
parent c44c42103c
commit f42d355fd7
3 changed files with 3 additions and 3 deletions

View File

@ -120,7 +120,7 @@ class ImageController extends Controller
{ {
$this->checkPermission('image-create-all'); $this->checkPermission('image-create-all');
$this->validate($request, [ $this->validate($request, [
'file' => 'is_image' 'file' => 'image'
]); ]);
if (!$this->imageRepo->isValidType($type)) { if (!$this->imageRepo->isValidType($type)) {

View File

@ -15,7 +15,7 @@ class AppServiceProvider extends ServiceProvider
public function boot() public function boot()
{ {
// Custom validation methods // Custom validation methods
Validator::extend('is_image', function ($attribute, $value, $parameters, $validator) { Validator::extend('image', function ($attribute, $value, $parameters, $validator) {
$imageMimes = ['image/png', 'image/bmp', 'image/gif', 'image/jpeg', 'image/jpg', 'image/tiff', 'image/webp']; $imageMimes = ['image/png', 'image/bmp', 'image/gif', 'image/jpeg', 'image/jpg', 'image/tiff', 'image/webp'];
return in_array($value->getMimeType(), $imageMimes); return in_array($value->getMimeType(), $imageMimes);
}); });

View File

@ -37,7 +37,7 @@ return [
'email' => 'The :attribute must be a valid email address.', 'email' => 'The :attribute must be a valid email address.',
'filled' => 'The :attribute field is required.', 'filled' => 'The :attribute field is required.',
'exists' => 'The selected :attribute is invalid.', 'exists' => 'The selected :attribute is invalid.',
'image' => 'The :attribute must be an image.', 'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.', 'in' => 'The selected :attribute is invalid.',
'integer' => 'The :attribute must be an integer.', 'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.', 'ip' => 'The :attribute must be a valid IP address.',