| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace App\Module\Pet\Models;
- use UCore\ModelCore;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- /**
- * 宠物争霸赛队伍成员模型
- *
- * field start
- * @property int $id
- * @property int $team_id 队伍ID
- * @property int $user_id 用户ID
- * @property int $pet_id 宠物ID
- * @property int $power 战力贡献
- * @property string $join_time
- * field end
- */
- class PetBattleTeamMember extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'pet_battle_team_members';
- // attrlist start
- protected $fillable = [
- 'id',
- 'team_id',
- 'user_id',
- 'pet_id',
- 'power',
- 'join_time',
- ];
- // attrlist end
- /**
- * 应该被转换为日期的属性
- *
- * @var array
- */
- protected $dates = [
- 'join_time',
- ];
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'team_id' => 'integer',
- 'user_id' => 'integer',
- 'pet_id' => 'integer',
- 'power' => 'integer',
- ];
- /**
- * 获取关联的队伍
- *
- * @return BelongsTo
- */
- public function team(): BelongsTo
- {
- return $this->belongsTo(PetBattleTeam::class, 'team_id');
- }
- /**
- * 获取关联的用户
- *
- * @return BelongsTo
- */
- public function user(): BelongsTo
- {
- return $this->belongsTo(\App\Models\User::class, 'user_id');
- }
- /**
- * 获取关联的宠物
- *
- * @return BelongsTo
- */
- public function pet(): BelongsTo
- {
- return $this->belongsTo(Pet::class, 'pet_id');
- }
- }
|