*/ protected $fillable = [ 'type', 'title', 'content', 'version', 'published_at', 'published_by', ]; /** * The attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'published_at' => 'datetime', ]; } /** * Get the user that published the document. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\User, \App\Models\LegalDocument> */ public function publishedBy(): BelongsTo { return $this->belongsTo(User::class, 'published_by'); } /** * Get the user document acceptances for the legal document. * * @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\UserDocumentAcceptance, \App\Models\LegalDocument> */ public function acceptances(): HasMany { return $this->hasMany(UserDocumentAcceptance::class); } }