问题描述
用户可以将一系列图像上传到我的应用程序,而这些图像在我的数据库中已经不存在。
上载新文件时,我会存储文件的MD5哈希值,然后可以使用此值检查它是否已存在。
我使用自定义的FormRequest进行验证:
public function rules()
{
return [
'pictures' => 'required|array|min:1','pictures.*' => [
'required','image','mimes:jpg,png,jpeg','max:5120',Rule::unique('files')->where(function ($query) {
//How to get the current item of this array to check?
//Is it a good idea?
//$query->where('hash',$currentImageHash )
})
]
];
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)