mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
remove $rules2
This commit is contained in:
parent
8ce577db37
commit
0b60cbc531
|
@ -39,21 +39,6 @@ class UpdateAssetRequest extends ImageUploadRequest
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
// OR
|
return $rules;
|
||||||
|
|
||||||
$rules2 = array_merge(
|
|
||||||
parent::rules(),
|
|
||||||
// collects rules, 'rejects' required rules not a fan of this approach, feels inflexible
|
|
||||||
// what if we decide something _is_ required, etc, it could get complicated and harder to read than the above
|
|
||||||
collect((new Asset)->getRules())->map(function ($rules) {
|
|
||||||
return collect($rules)->reject(function ($rule) {
|
|
||||||
return $rule === 'required';
|
|
||||||
})->reject(function ($rule) {
|
|
||||||
return $rule === 'unique_undeleted:assets,asset_tag';
|
|
||||||
})->values()->all();
|
|
||||||
})->all(),
|
|
||||||
);
|
|
||||||
|
|
||||||
return $rules2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue