'date', ]; public function employee(): BelongsTo { return $this->belongsTo(Employee::class)->withTrashed(); } public function simperType(): BelongsTo { return $this->belongsTo(SimperType::class); } public function isValid(): bool { if ($this->status !== self::STATUS_ACTIVE || ! $this->expired_at) { return false; } return $this->expired_at->isFuture() || $this->expired_at->isToday(); } public function scopeActive(Builder $query): Builder { return $query->where('status', self::STATUS_ACTIVE); } public function scopeValid(Builder $query): Builder { $today = Carbon::today()->toDateString(); return $query->where('status', self::STATUS_ACTIVE) ->whereNotNull('expired_at') ->where('expired_at', '>=', $today); } }