merge([ 'active' => $this->boolean('active'), 'scheduleStart' => $this->boolean('scheduleStart'), 'scheduleEnd' => $this->boolean('scheduleEnd'), 'start_publication_date' => $this->boolean('scheduleStart') ? $this->input('start_publication_date') : now()->format('Y-m-d'), 'stop_publication_date' => $this->boolean('scheduleEnd') ? $this->input('stop_publication_date') : '2100-01-01', ]); } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return [ 'headline' => ['required', 'string'], 'body' => ['required', 'string'], 'active' => ['required', 'boolean'], 'scheduleStart' => ['sometimes', 'boolean'], 'start_publication_date' => ['nullable', 'date'], 'scheduleEnd' => ['sometimes', 'boolean'], 'stop_publication_date' => ['nullable', 'date', 'after_or_equal:start_publication_date'], ]; } }