php - Laravel:即使在laravel中与其他人一样,如何做身份号码也不应该是相同的
问题描述
晚上好。目前我面临为一个人保存身份证号码的问题。每个人应该有不同的身份号码。如果识别号相同意味着数据不应该保存,但在我的情况下,即使具有相同的数据也会保存数据。任何人都可以在这方面提供帮助吗?
检查数据是否存在
public function check_child_birth_cert(){
if(Child::where('child_birth_certificate_no')
->exists()){
return "exist";
}else{
return "not exist";
}
}
创建数据
'child_data.child_birth_certificate_no':function(){
axios.get('check_child_birth_cert/'+ this.pros.child_birth_cert)
.then(reponse =>{
this.child_birth_certificate_no=reponse.data;
})
}
调用函数 repo 到控制器
public function getchildBirth_cert(Request $request){
$this->childRepository->check_child_birth_cert($request->all());
}
解决方案
检查 Laravel 码头https://laravel.com/docs/7.x/queries#where-clauses。你写了where
没有选项的语句,在哪里列child_birth_certificate_no
什么?也许等于什么?^_^
推荐阅读
- node.js - 使用每个数组的长度将 3 个数组合并为一个数组
- excel - 索引/匹配以返回匹配条件的结果列表
- angular - 如何使用可观察的角度进行一致的http调用?
- python - 多页 Dash 应用回调未注册
- firebase - 如何在 Vuexfire 中使用 Moment.js
- rest - 用于传入整数数组的正确的rest uri格式?
- json - @RequestBody 不适用于 @JsonProperty
- entity-framework - Entity Framework Core:在 SQL 中生成重复的列名
- html - 防止在表格内调整图像大小(表格在另一个单元格内)
- node.js - 出现错误:“url”参数必须是字符串类型。尝试发布到 Heroku 上托管的 Slack 机器人时收到类型未定义