*/ protected $fillable = [ 'document_id', 'user_id', 'downloaded_at', 'ip_address', ]; /** * 应该被转换为日期的属性 * * @var array */ protected $casts = [ 'downloaded_at' => 'datetime', ]; /** * 获取下载日志关联的文档 */ public function document(): BelongsTo { return $this->belongsTo(Document::class); } /** * 获取下载日志关联的用户 */ public function user(): BelongsTo { return $this->belongsTo(User::class); } }