我将获得存在于数据库中或在范围内的字段数据.是否有可能检查输入验证,即并发(存在于字段数据库中)或(在:0,NULL)
我们应该确定这样的自定义验证器:
public function validateCustomExists($attribute, $value, $parameters)
{
if ($value == 0)
return true;
else
return $this->validateExists($attribute, $value, $parameters);
}
Run Code Online (Sandbox Code Playgroud)
并在模型验证中:
$this->rules = array(
'field_id' => 'custom_exists:tableName,fieldName',
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2085 次 |
| 最近记录: |