mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 06:03:39 +08:00
Only validate dirty attributes
To prevent unique-checking queries on every update
This commit is contained in:
parent
761b76539d
commit
ccf63a65e9
|
@ -130,9 +130,11 @@ class Model extends Eloquent
|
|||
*/
|
||||
protected function makeValidator()
|
||||
{
|
||||
$rules = $this->expandUniqueRules(static::$rules);
|
||||
$dirty = $this->getDirty();
|
||||
|
||||
return static::$validator->make($this->attributes, $rules);
|
||||
$rules = $this->expandUniqueRules(array_only(static::$rules, array_keys($dirty)));
|
||||
|
||||
return static::$validator->make($dirty, $rules);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user