| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?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');
- }
- /**
- * 获取关联的宝箱内容
- *
- * @return BelongsTo
- */
- public function chestContent(): BelongsTo
- {
- return $this->belongsTo(ItemChestContent::class, 'chest_content_id');
- }
- }
|