2026-03-01 15:03:34 +08:00
|
|
|
<?php
|
|
|
|
|
|
2026-03-01 19:05:52 +08:00
|
|
|
/**
|
|
|
|
|
* 文件功能:婚礼仪式记录模型
|
|
|
|
|
*
|
|
|
|
|
* 对应 wedding_ceremonies 表,记录每一场婚礼的档位、支付方式、
|
|
|
|
|
* 举办时间及红包分发情况。关联婚姻记录和红包领取记录。
|
|
|
|
|
*
|
|
|
|
|
* @author ChatRoom Laravel
|
|
|
|
|
*
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
*/
|
|
|
|
|
|
2026-03-01 15:03:34 +08:00
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2026-03-01 19:05:52 +08:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
2026-03-01 15:03:34 +08:00
|
|
|
|
|
|
|
|
class WeddingCeremony extends Model
|
|
|
|
|
{
|
2026-03-01 19:05:52 +08:00
|
|
|
/**
|
|
|
|
|
* 允许批量赋值的字段列表。
|
|
|
|
|
*
|
|
|
|
|
* @var list<string>
|
|
|
|
|
*/
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'marriage_id',
|
|
|
|
|
'tier_id',
|
|
|
|
|
'total_amount',
|
|
|
|
|
'payer_type',
|
|
|
|
|
'groom_amount',
|
|
|
|
|
'partner_amount',
|
|
|
|
|
'ceremony_type',
|
|
|
|
|
'ceremony_at',
|
|
|
|
|
'status',
|
|
|
|
|
'online_count',
|
|
|
|
|
'claimed_count',
|
|
|
|
|
'claimed_amount',
|
|
|
|
|
'expires_at',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 字段类型转换。
|
|
|
|
|
*
|
|
|
|
|
* @return array<string, string>
|
|
|
|
|
*/
|
|
|
|
|
protected function casts(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'ceremony_at' => 'datetime',
|
|
|
|
|
'expires_at' => 'datetime',
|
|
|
|
|
'total_amount' => 'integer',
|
|
|
|
|
'groom_amount' => 'integer',
|
|
|
|
|
'partner_amount' => 'integer',
|
|
|
|
|
'online_count' => 'integer',
|
|
|
|
|
'claimed_count' => 'integer',
|
|
|
|
|
'claimed_amount' => 'integer',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 关联婚姻记录。
|
|
|
|
|
*/
|
|
|
|
|
public function marriage(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Marriage::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 关联婚礼档位。
|
|
|
|
|
*/
|
|
|
|
|
public function tier(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(WeddingTier::class, 'tier_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 关联红包领取记录。
|
|
|
|
|
*/
|
|
|
|
|
public function claims(): HasMany
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(WeddingEnvelopeClaim::class, 'ceremony_id');
|
|
|
|
|
}
|
2026-03-01 15:03:34 +08:00
|
|
|
}
|