user_id)->lock(true)->find(); if (!$user) { throw new Exception("The user can't find it"); } if (!$model->memo) { throw new Exception("Change note cannot be blank"); } $model->before = $user->score; $user->score += $model->score; $user->save(); $model->after = $user->score; } public static function onBeforeDelete(): bool { return false; } public function user(): BelongsTo { return $this->belongsTo(User::class, 'user_id'); } }