| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace App\Module\Pet\Models;
- use UCore\ModelCore;
- use App\Module\Pet\Enums\PetStatus;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- /**
- * 宠物技能模型
- *
- * field start
- * @property int $id
- * @property string $skill_name 技能名称
- * @property int $stamina_cost 体力消耗
- * @property int $cool_down 冷却时间(秒)
- * @property int $duration_time 持续时间(秒)
- * @property string $effect_desc 效果描述
- * @property int $min_level 最低等级要求
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * field end
- */
- class PetSkill extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'pet_skills';
- /**
- * 可批量赋值的属性
- *
- * @var array
- */
- // attrlist start
- protected $fillable = [
- 'id',
- 'skill_name',
- 'stamina_cost',
- 'cool_down',
- 'duration_time',
- 'effect_desc',
- 'min_level',
- ];
- // attrlist end
- /**
- * 属性类型转换
- *
- * @var array
- */
- protected $casts = [
- 'stamina_cost' => 'integer',
- 'cool_down' => 'integer',
- 'min_level' => 'integer',
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- ];
- /**
- * 获取技能的使用记录
- *
- * @return HasMany
- */
- public function usageLogs(): HasMany
- {
- return $this->hasMany(PetSkillLog::class, 'skill_id');
- }
- }
|