'int', 'version_no' => 'int', 'valid_until' => 'date', 'total_price' => 'decimal:2', 'template_id' => 'int', 'pdf_archived' => 'bool', 'sent_at' => 'datetime', 'accepted_at' => 'datetime', 'template_document_ids' => 'array', 'created_by' => 'int', ]; public function offer(): BelongsTo { return $this->belongsTo(Offer::class); } public function template(): BelongsTo { return $this->belongsTo(OfferTemplate::class, 'template_id'); } public function items(): HasMany { return $this->hasMany(OfferItem::class)->orderBy('position'); } public function files(): HasMany { return $this->hasMany(OfferFile::class); } public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } public function isEditable(): bool { return $this->status === self::STATUS_DRAFT; } }