whereIsDefault(1); } public function scopeType($query, int $type): void { // 筛选类型 $query->whereType($type); } public function setDefault(): bool { // 设置默认 self::type($this->type)->default()->update(['is_default' => 0]); // unset original default config return $this->update(['is_default' => 1]); } }