=, <= * @property int $sort_order 排序顺序,用于多条件任务 * @property bool $is_required 是否必须满足此条件(0:否, 1:是) * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 更新时间 * field end */ class TaskAchievementCondition extends ModelCore { /** * 与模型关联的表名 * * @var string */ protected $table = 'task_achievement_conditions'; /** * 主键 * * @var string */ protected $primaryKey = 'id'; /** * 应该被转换为原生类型的属性 * * @var array */ protected $casts = [ 'params' => 'array', 'is_required' => 'boolean', ]; // attrlist start protected $fillable = [ 'id', 'task_id', 'condition_id', 'condition_type', 'target_value', 'params', 'operator', 'sort_order', 'is_required', ]; // attrlist end /** * 获取关联的任务 * * @return BelongsTo */ public function task(): BelongsTo { return $this->belongsTo(Task::class, 'task_id', 'id'); } /** * 获取关联的条件 * * @return BelongsTo */ public function condition(): BelongsTo { return $this->belongsTo(TaskCondition::class, 'condition_id', 'id'); } /** * 获取用户任务进度 * * @return HasMany */ public function userProgress(): HasMany { return $this->hasMany(TaskUserProgress::class, 'achievement_condition_id', 'id'); } }