| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Module\GameItems\Models;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- use UCore\ModelCore;
- /**
- * 物品组
- *
- * field start
- * @property int $id 物品组ID,主键
- * @property string $name 物品组名称
- * @property string $code 物品组编码(唯一)
- * @property string $description 物品组描述
- * @property \Carbon\Carbon $created_at 创建时间
- * @property \Carbon\Carbon $updated_at 更新时间
- * field end
- */
- class ItemGroup extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'item_groups';
- // attrlist start
- protected $fillable = [
- 'id',
- 'name',
- 'code',
- 'description',
- ];
- // attrlist end
- /**
- * 获取物品组中的所有物品
- *
- * @return HasMany
- */
- public function groupItems(): HasMany
- {
- return $this->hasMany(ItemGroupItem::class, 'group_id','id');
- }
- /**
- * 获取物品组中的所有宝箱内容配置
- *
- * @return HasMany
- */
- public function chestContents(): HasMany
- {
- return $this->hasMany(ItemChestContent::class, 'group_id','id');
- }
- }
|