mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
Add model validation messages
This commit is contained in:
parent
1a1ccec5a3
commit
f48a9b2aca
|
@ -134,7 +134,14 @@ class Model extends Eloquent
|
|||
|
||||
$rules = $this->expandUniqueRules(array_only(static::$rules, array_keys($dirty)));
|
||||
|
||||
return static::$validator->make($dirty, $rules);
|
||||
// TODO: translation
|
||||
$messages = [
|
||||
'unique' => 'That :attribute has already been taken.',
|
||||
'email' => 'The :attribute must be a valid email address.',
|
||||
'alpha_num' => 'The :attribute may only contain letters and numbers.'
|
||||
];
|
||||
|
||||
return static::$validator->make($dirty, $rules, $messages);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user