ModelValidation.php 400 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace UCore\Validation;
  3. use Illuminate\Database\Eloquent\Model;
  4. use UCore\ValidationCore;
  5. class ModelValidation extends ValidationCore
  6. {
  7. /**
  8. * 使用模型数据 进行初始化
  9. *
  10. * @return static
  11. */
  12. public static function makeByModel(Model $model, $rules = [], $scene = '')
  13. {
  14. return new static($model->toArray(), $rules, [], $scene);
  15. }
  16. }