我有一个自定义规则ValidateID,我有这个代码来使用规则:
public function store(Request $request, $id, $slug = null, Validator $validator){
$rules = [];
$messages = [];
$rules["name"] = 'required|max:255|string';
$rules([
"ID" =>['required', 'string', new ValidateID()]
]);
}
但是下面出现错误,你知道为什么吗?
{message: "Function name must be a string",…}exception
message:"Function name must be a string"