| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace App\Module\Task\Models;
- use UCore\ModelCore;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- /**
- * 任务条件模型
- *
- * field start
- * @property int $id 主键
- * @property string $code 条件代码(唯一),如login, plant, harvest
- * @property string $name 条件名称,如登录游戏, 种植作物, 收获作物
- * @property string $description 条件描述
- * @property object|array $param_schema 参数模式,定义此条件需要的参数及其类型
- * @property string $handler_class 处理此条件的类名
- * @property int $is_active 是否激活(0:否, 1:是)
- * @property \Carbon\Carbon $created_at 创建时间
- * @property \Carbon\Carbon $updated_at 更新时间
- * field end
- */
- class TaskCondition extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'task_conditions';
- /**
- * 主键
- *
- * @var string
- */
- protected $primaryKey = 'id';
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'param_schema' => 'array',
- 'is_active' => 'boolean',
- ];
- // attrlist start
- protected $fillable = [
- 'id',
- 'code',
- 'name',
- 'description',
- 'param_schema',
- 'handler_class',
- 'is_active',
- ];
- // attrlist end
- /**
- * 获取使用此条件的任务达成条件
- *
- * @return HasMany
- */
- public function achievementConditions(): HasMany
- {
- return $this->hasMany(TaskAchievementCondition::class, 'condition_id', 'id');
- }
- }
|