forceFill([ 'precheck_reviewed_at' => now(), 'precheck_reviewed_by' => $admin->getKey(), 'precheck_review_note' => $note, 'withheld_at' => null, ])->save(); $this->audit($image, 'approved', $note); }); if ($image->pressRelease?->published_at !== null) { WebCaches::forgetPublicPages(); } } public function reject(PressReleaseImage $image, User $admin, string $note): void { DB::transaction(function () use ($image, $admin, $note): void { $image->forceFill([ 'precheck_reviewed_at' => now(), 'precheck_reviewed_by' => $admin->getKey(), 'precheck_review_note' => $note, ])->save(); $this->audit($image, 'rejected', $note); }); $this->remover->remove($image, $admin, ArchiveEvent::ImageRemoved, ArchiveReasonCategory::OwnDecision); } private function audit(PressReleaseImage $image, string $decision, string $note): void { KiAudit::query()->create([ 'press_release_id' => $image->press_release_id, 'type' => KiAudit::TYPE_IMAGE_PRECHECK_REVIEW, 'provider' => 'admin', 'model' => null, 'result' => $decision, 'reason' => $note, 'raw_response' => [ 'image_id' => $image->getKey(), 'reviewed_by' => $image->precheck_reviewed_by, 'precheck' => $image->precheck, ], 'created_at' => now(), ]); } }