| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace App\Module\Game\Models;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use UCore\ModelCore;
- /**
- * 奖励发放日志
- *
- * field start
- * @property int $id 主键
- * @property int $user_id 用户ID
- * @property int $group_id 奖励组ID
- * @property string $source_type 来源类型(task, activity, sign_in等)
- * @property int $source_id 来源ID
- * @property array $reward_items 发放的奖励项(JSON格式)
- * @property \Carbon\Carbon $created_at 创建时间
- * field end
- */
- class GameRewardLog extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'game_reward_logs';
- /**
- * 指示模型是否应该被打上时间戳
- * 由于这是日志表,只需要创建时间,不需要更新时间
- *
- * @var bool
- */
- public $timestamps = true;
- /**
- * 更新时间戳字段名
- * 设置为null表示不使用updated_at字段
- *
- * @var string|null
- */
- const UPDATED_AT = null;
- // attrlist start
- protected $fillable = [
- 'id',
- 'user_id',
- 'group_id',
- 'source_type',
- 'source_id',
- 'reward_items',
- 'created_at',
- ];
- // attrlist end
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'user_id' => 'integer',
- 'group_id' => 'integer',
- 'source_id' => 'integer',
- 'reward_items' => 'json',
- ];
- /**
- * 获取奖励日志关联的奖励组
- *
- * @return BelongsTo
- */
- public function rewardGroup(): BelongsTo
- {
- return $this->belongsTo(GameRewardGroup::class, 'group_id', 'id');
- }
- }
|