Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Error Messages not work #17

Open
j955 opened this issue May 29, 2016 · 5 comments
Open

Custom Error Messages not work #17

j955 opened this issue May 29, 2016 · 5 comments

Comments

@j955
Copy link

j955 commented May 29, 2016

hi ~
your "l5-repository" is very good , thank you!
but i'm use laravel-validator example code setting Custom Error Messages is not work
my project is Laravel 5.1 LTS + dingo Api

@childeYin
Copy link

yeah i have the same problem, when
`
postValidator.php
protected $messages = [
'required' => 'false please try again.',
];
postController.php
try{
....
}catch(ValidatorException $e){
$result = [
'error' =>true,
'message' =>$e->getMessage()
];
}

i see
ValidatorException.php its function like:
public function __construct(MessageBag $messageBag){
$this->messageBag = $messageBag;
},

MessageBag.php

public function __construct(array $messages = [])
{
foreach ($messages as $key => $value) {
$this->messages[$key] = (array) $value;
}
}

`

if use it as like that $messages is not i gave,except new MessageBag($messages) or Validator::make('', '', $messages), i don't know laravel-validator how to get i defined messages.

@motopig
Copy link

motopig commented Jul 18, 2016

dev-master version solve this issue, but https://packagist.org/packages/prettus/l5-repository#2.6.6 this version require prettus/laravel-validation: 1.1.* .

@tucq88
Copy link

tucq88 commented Sep 14, 2016

Maybe we need @andersao merges updates to master 😟

@motopig
Copy link

motopig commented Sep 20, 2016

@tucq88 i solve this problem by override class LaravelValidator -> passes function

@ricardofilho6
Copy link

How did you guys solve this issue? Overriding function passes didn't work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants