| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace App\Module\Pet\Models;
- use UCore\ModelCore;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- /**
- * 宠物争霸赛赛季模型
- *
- * field start
- * @property int $id
- * @property string $name 赛季名称
- * @property string $start_time 开始时间
- * @property string $end_time 结束时间
- * @property int $boss_power Boss战力
- * @property object|array $reward_pool 奖池配置
- * @property int $status 状态:0未开始,1进行中,2已结束
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * field end
- */
- class PetBattleSeason extends ModelCore
- {
- /**
- * 赛季状态常量
- */
- const STATUS_NOT_STARTED = 0; // 未开始
- const STATUS_IN_PROGRESS = 1; // 进行中
- const STATUS_ENDED = 2; // 已结束
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'pet_battle_seasons';
- // attrlist start
- protected $fillable = [
- 'id',
- 'name',
- 'start_time',
- 'end_time',
- 'boss_power',
- 'reward_pool',
- 'status',
- ];
- // attrlist end
- /**
- * 应该被转换为日期的属性
- *
- * @var array
- */
- protected $dates = [
- 'start_time',
- 'end_time',
- 'created_at',
- 'updated_at',
- ];
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'boss_power' => 'integer',
- 'reward_pool' => 'json',
- 'status' => 'integer',
- ];
- /**
- * 获取赛季的所有队伍
- *
- * @return HasMany
- */
- public function teams(): HasMany
- {
- return $this->hasMany(PetBattleTeam::class, 'season_id');
- }
- }
|