diff --git a/app/Models/ActivityLog.php b/app/Models/ActivityLog.php index ab78204bd..eb975ddc8 100644 --- a/app/Models/ActivityLog.php +++ b/app/Models/ActivityLog.php @@ -21,7 +21,6 @@ use Illuminate\Support\Str; * \App\Models\ActivityLog. * * @property int $id - * @property string|null $batch * @property string $event * @property string $ip * @property string|null $description @@ -43,7 +42,6 @@ use Illuminate\Support\Str; * @method static Builder|ActivityLog whereActorId($value) * @method static Builder|ActivityLog whereActorType($value) * @method static Builder|ActivityLog whereApiKeyId($value) - * @method static Builder|ActivityLog whereBatch($value) * @method static Builder|ActivityLog whereDescription($value) * @method static Builder|ActivityLog whereEvent($value) * @method static Builder|ActivityLog whereId($value) @@ -76,7 +74,6 @@ class ActivityLog extends Model implements HasIcon, HasLabel /** @var array */ public static array $validationRules = [ 'event' => ['required', 'string'], - 'batch' => ['nullable', 'uuid'], 'ip' => ['required', 'string'], 'description' => ['nullable', 'string'], 'properties' => ['array'], diff --git a/app/Providers/ActivityLogServiceProvider.php b/app/Providers/ActivityLogServiceProvider.php index f783a3fd0..1bbb35c40 100644 --- a/app/Providers/ActivityLogServiceProvider.php +++ b/app/Providers/ActivityLogServiceProvider.php @@ -3,7 +3,6 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; -use App\Services\Activity\ActivityLogBatchService; use App\Services\Activity\ActivityLogTargetableService; class ActivityLogServiceProvider extends ServiceProvider @@ -14,7 +13,6 @@ class ActivityLogServiceProvider extends ServiceProvider */ public function register(): void { - $this->app->scoped(ActivityLogBatchService::class); $this->app->scoped(ActivityLogTargetableService::class); } } diff --git a/app/Services/Activity/ActivityLogBatchService.php b/app/Services/Activity/ActivityLogBatchService.php deleted file mode 100644 index df237286f..000000000 --- a/app/Services/Activity/ActivityLogBatchService.php +++ /dev/null @@ -1,60 +0,0 @@ -uuid; - } - - /** - * Starts a new batch transaction. If there is already a transaction present - * this will be nested. - */ - public function start(): void - { - if ($this->transaction === 0) { - $this->uuid = Uuid::uuid4()->toString(); - } - - $this->transaction++; - } - - /** - * Ends a batch transaction, if this is the last transaction in the stack - * the UUID will be cleared out. - */ - public function end(): void - { - $this->transaction = max(0, $this->transaction - 1); - - if ($this->transaction === 0) { - $this->uuid = null; - } - } - - /** - * Executes the logic provided within the callback in the scope of an activity - * log batch transaction. - */ - public function transaction(\Closure $callback): mixed - { - $this->start(); - $result = $callback($this->uuid()); - $this->end(); - - return $result; - } -} diff --git a/app/Services/Activity/ActivityLogService.php b/app/Services/Activity/ActivityLogService.php index 7cb7a214f..06d4331c2 100644 --- a/app/Services/Activity/ActivityLogService.php +++ b/app/Services/Activity/ActivityLogService.php @@ -24,7 +24,6 @@ class ActivityLogService public function __construct( protected AuthFactory $manager, - protected ActivityLogBatchService $batch, protected ActivityLogTargetableService $targetable, protected ConnectionInterface $connection ) {} @@ -201,7 +200,6 @@ class ActivityLogService $this->activity = new ActivityLog([ 'ip' => Request::ip(), - 'batch_uuid' => $this->batch->uuid(), 'properties' => Collection::make([]), 'api_key_id' => $this->targetable->apiKeyId(), ]); diff --git a/app/Transformers/Api/Client/ActivityLogTransformer.php b/app/Transformers/Api/Client/ActivityLogTransformer.php index 58388dec1..a5ee7493b 100644 --- a/app/Transformers/Api/Client/ActivityLogTransformer.php +++ b/app/Transformers/Api/Client/ActivityLogTransformer.php @@ -26,7 +26,6 @@ class ActivityLogTransformer extends BaseClientTransformer // the front-end for each entry to improve rendering performance since there // is nothing else sufficiently unique to key off at this point. 'id' => sha1((string) $model->id), - 'batch' => $model->batch, 'event' => $model->event, 'is_api' => !is_null($model->api_key_id), 'ip' => $this->canViewIP($model->actor) ? $model->ip : null, diff --git a/database/migrations/2025_09_03_080547_remove_batch_column_from_activity_logs.php b/database/migrations/2025_09_03_080547_remove_batch_column_from_activity_logs.php new file mode 100644 index 000000000..eda184e31 --- /dev/null +++ b/database/migrations/2025_09_03_080547_remove_batch_column_from_activity_logs.php @@ -0,0 +1,28 @@ +dropColumn('batch'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('activity_logs', function (Blueprint $table) { + $table->string('batch', 36)->nullable(); + }); + } +};