From 41a7cd65cfd1b8ab06a05eb7596639b49baadf79 Mon Sep 17 00:00:00 2001 From: panabonic Date: Thu, 7 Sep 2023 11:27:15 +0300 Subject: [PATCH] cleaner update --- app/Services/Registries/CleanerService.php | 29 ++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/app/Services/Registries/CleanerService.php b/app/Services/Registries/CleanerService.php index 3366245..6db2517 100644 --- a/app/Services/Registries/CleanerService.php +++ b/app/Services/Registries/CleanerService.php @@ -2,6 +2,9 @@ namespace App\Services\Registries; +use App\Models\Objects\Values\HtmlValue; +use App\Models\Objects\Values\StringValue; +use App\Models\Objects\Values\TextValue; use App\Models\Publications\Publication; use App\Models\Registries\Entry; use Illuminate\Support\Str; @@ -11,8 +14,11 @@ class CleanerService { } public function clean() { - $this->cleanPublications(); - $this->cleanRegistryEntries(); + //$this->cleanPublications(); + //$this->cleanRegistryEntries(); + $this->cleanStringValues(); + $this->cleanTextValues(); + $this->cleanHtmlValues(); } public function cleanPublications() { @@ -29,6 +35,25 @@ class CleanerService { } } + public function cleanStringValues() { + $items = StringValue::all(); + foreach ($items as $item) { + $item->update(['value' => $this->cleanString($item->value)]); + } + } + public function cleanTextValues() { + $items = TextValue::all(); + foreach ($items as $item) { + $item->update(['value' => $this->cleanString($item->value)]); + } + } + public function cleanHtmlValues() { + $items = HtmlValue::all(); + foreach ($items as $item) { + $item->update(['value' => $this->cleanString($item->value)]); + } + } + public function cleanString(?string $string): ?string { if ($string) {