'datetime']; } /** * The version in force: the newest published one. * * Newest by publication, not by id — a version prepared earlier and * published later is the later one, and the id says nothing about that. */ public static function current(): ?self { return static::query() ->whereNotNull('published_at') ->where('published_at', '<=', now()) ->latest('published_at') ->first(); } public function isPublished(): bool { return $this->published_at !== null && $this->published_at->isPast(); } public function acceptances(): HasMany { return $this->hasMany(DpaAcceptance::class); } public function operator() { return $this->belongsTo(Operator::class, 'created_by'); } }