当我尝试将记录插入这样的表格时,我遇到了问题。
$data = array();
foreach($input['user_id'] as $key => $user_id) {
$data[$key]['user_id'] = $user_id;
}
foreach($input['start_on'] as $key => $start_on) {
$data[$key]['start_on'] = $start_on;
}
$this->validate($request, [
'time_start' => 'required|date',
'time_end' => 'required|date|after:time_start',
]);
$rules = [
'start_on' => 'required|date|after:time_start|before:time_end|different:start_on'
];
// Iterate and validate each question
foreach ($data as $value)
{
$validator = Validator::make( $value, $rules );
// if ($validator->fails()) return $validator->messages()->all();
}
我想检查start_on不等于另一个start_on。我该怎么办?