我在laravel中有一套验证规则。有两个日期字段,其中一个必须大于其他字段。但是当我使用gt运算符时,出现错误:
$validation = Validator::make($request->all(), [
'description' => 'required|string',
'started_at' => 'required|date',
'finished_at' => 'required|date|gt:started_at',
]);
错误是:Method Illuminate\Validation\Validator::validateGt does not exist.
答案 0 :(得分:2)
gt:started_at 错误 gt 规则在laravel中不存在之后
$validation = Validator::make($request->all(), [
'description' => 'required|string',
'started_at' => 'required|date',
'finished_at' => 'required|date|after:started_at',
]);