我不明白为什么规则不会选择合并的输入。这是规则方法:
public function rules(Event_Segment $segment)
{
$segment = $segment->where('event_id', $this->input('event'));
$this->merge(['run' => $segment->count(), 'publish' => $segment->where('publish', 1)->count()]);
return [
'event' => 'exists:fed_event,id,fed_id,' . $this->route('id') . ',run,2',
'run' => 'required|same:publish'
];
}
当我提交表单时,会出现错误消息,说明run
是必需的。