*/ protected $fillable = [ 'ceremony_id', 'user_id', 'amount', 'claimed', 'claimed_at', 'created_at', ]; /** * 获取属性类型转换。 * * @return array */ protected function casts(): array { return [ 'claimed' => 'boolean', 'claimed_at' => 'datetime', 'created_at' => 'datetime', 'amount' => 'integer', ]; } /** * 关联婚礼仪式。 */ public function ceremony(): BelongsTo { return $this->belongsTo(WeddingCeremony::class, 'ceremony_id'); } /** * 关联领取用户。 */ public function user(): BelongsTo { return $this->belongsTo(User::class, 'user_id'); } }