| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Module\GameItems\Models;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use UCore\ModelCore;
- /**
- * 宝箱保底计数
- *
- * field start
- * @property int $id 记录ID,主键
- * @property int $user_id 用户ID
- * @property int $chest_id 宝箱ID,外键关联kku_item_items表
- * @property int $chest_content_id 宝箱内容ID,外键关联kku_item_chest_contents表
- * @property int $current_count 当前计数,每开启一次宝箱增加1
- * @property string $last_reset_time 上次重置时间(可用于周期性重置)
- * @property \Carbon\Carbon $created_at 创建时间
- * @property \Carbon\Carbon $updated_at 更新时间
- * field end
- */
- class ItemPityTime extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'item_pity_times';
- // attrlist start
- protected $fillable = [
- 'id',
- 'user_id',
- 'chest_id',
- 'chest_content_id',
- 'current_count',
- 'last_reset_time',
- ];
- // attrlist end
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'current_count' => 'integer',
- ];
- /**
- * 获取关联的宝箱
- *
- * @return BelongsTo
- */
- public function chest(): BelongsTo
- {
- return $this->belongsTo(Item::class, 'chest_id');
- }
- }
|