| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace App\Module\Game\Models;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- use UCore\ModelCore;
- /**
- * 奖励组
- *
- * field start
- * @property int $id 主键
- * @property string $name 奖励组名称
- * @property string $code 奖励组编码(唯一)
- * @property string $description 奖励组描述
- * @property int $is_random 是否随机发放(0:全部发放, 1:随机发放)
- * @property int $random_count 随机发放时的奖励数量
- * @property \Carbon\Carbon $created_at 创建时间
- * @property \Carbon\Carbon $updated_at 更新时间
- * field end
- */
- class GameRewardGroup extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'game_reward_groups';
- // attrlist start
- protected $fillable = [
- 'id',
- 'name',
- 'code',
- 'description',
- 'is_random',
- 'random_count',
- ];
- // attrlist end
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'is_random' => 'boolean',
- 'random_count' => 'integer',
- ];
- /**
- * 获取奖励组中的所有奖励项
- *
- * @return HasMany
- */
- public function rewardItems(): HasMany
- {
- return $this->hasMany(GameRewardItem::class, 'group_id', 'id');
- }
- }
|