'integer', 'effective_date' => 'date', 'end_date' => 'date', 'voided_at' => 'datetime', ]; /** 短期(临时)变价:有结束日期,到期后回到原来的长期报价。 */ public function isTemporary(): bool { return $this->end_date !== null; } /** 某一天是否在这一版的执行期间内(开始 ≤ 日期 ≤ 结束;长期版本没有结束)。 */ public function coversDate(\DateTimeInterface $date): bool { $day = \Illuminate\Support\Carbon::instance($date)->startOfDay(); return $this->effective_date !== null && $this->effective_date->lte($day) && ($this->end_date === null || $this->end_date->gte($day)); } /** 执行期间文字,如「2026-10-12 至 2026-10-15(临时)」或「2026-10-01 起」。 */ public function periodLabel(): string { if ($this->effective_date === null) { return '-'; } return $this->end_date !== null ? $this->effective_date->toDateString() . ' 至 ' . $this->end_date->toDateString() . '(临时)' : $this->effective_date->toDateString() . ' 起'; } public function isVoided(): bool { return $this->status === self::STATUS_VOIDED; } public function change(): BelongsTo { return $this->belongsTo(CourierQuoteChange::class, 'source_change_id'); } public function signature(): HasOne { return $this->hasOne(CourierQuoteSignature::class, 'quote_version_id'); } }