mirror of
https://github.com/flarum/core.git
synced 2025-05-31 03:29:40 +02:00
Only validate dirty attributes
To prevent unique-checking queries on every update
This commit is contained in:
parent
3334063740
commit
5d28fc2713
@ -130,9 +130,11 @@ class Model extends Eloquent
|
|||||||
*/
|
*/
|
||||||
protected function makeValidator()
|
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…
x
Reference in New Issue
Block a user