Laravel 5表单请求将输入合并到规则中

时间:2015-08-09 02:33:04

标签: php laravel-5.1

我不明白为什么规则不会选择合并的输入。这是规则方法:

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是必需的。

0 个答案:

没有答案