From e54320ea54f32bd127c0cc5f4b737060feb428f1 Mon Sep 17 00:00:00 2001 From: Julian Prieber Date: Mon, 9 Dec 2024 14:53:03 +0100 Subject: [PATCH] Migrate Twitter icon to X --- .../views/components/finishing.blade.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/resources/views/components/finishing.blade.php b/resources/views/components/finishing.blade.php index 538cf5d..c8938a2 100644 --- a/resources/views/components/finishing.blade.php +++ b/resources/views/components/finishing.blade.php @@ -7,6 +7,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\File; use Database\Seeders\ButtonSeeder; use App\Models\Page; +use App\Models\Link; set_time_limit(0); @@ -429,6 +430,30 @@ try { session(['update_error' => $e->getMessage()]); } +try { + + $links = Link::where('button_id', 94)->get()->groupBy('user_id'); + + foreach ($links as $userId => $userLinks) { + $hasXTwitter = $userLinks->contains('title', 'x-twitter'); + + foreach ($userLinks as $link) { + if ($link->title == 'twitter') { + if ($hasXTwitter) { + $link->delete(); + } else { + $link->title = 'x-twitter'; + $link->save(); + $hasXTwitter = true; + } + } + } + } + +} catch (exception $e) { +session(['update_error' => $e->getMessage()]); +} + try { $themesPath = base_path('themes');