Skip to content

Commit e977f0d

Browse files
committed
Update pre-update.blade.php
1 parent 31c8ba0 commit e977f0d

File tree

1 file changed

+37
-34
lines changed

1 file changed

+37
-34
lines changed

resources/views/components/pre-update.blade.php

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use Illuminate\Support\Facades\DB;
55
use App\Models\Link;
66
7-
// Disable execution time limit
87
set_time_limit(0);
98
109
if(trim(file_get_contents(base_path("version.json"))) < '4.0.0'){
@@ -17,10 +16,8 @@
1716
} catch (Exception $e) {}
1817
}
1918
20-
// Check version
2119
if (trim(file_get_contents(base_path("version.json"))) < '4.8.1') {
2220
23-
// First, check if the 'type' and 'type_params' columns exist, and add them if they don't
2421
if (!Schema::hasColumn('links', 'type')) {
2522
Schema::table('links', function (Blueprint $table) {
2623
$table->string('type')->nullable();
@@ -33,42 +30,48 @@
3330
});
3431
}
3532
36-
// Get all links
3733
$links = Link::all();
3834
3935
foreach ($links as $link) {
40-
$type = null;
36+
$type = null;
37+
$params = false;
4138
42-
// Assign type based on button_id
43-
switch ($link->button_id) {
44-
case "1":
45-
case "2":
46-
$type = "link";
47-
break;
48-
case "43":
49-
$type = "spacer";
50-
break;
51-
case "42":
52-
$type = "heading";
53-
break;
54-
case "93":
55-
$type = "text";
56-
break;
57-
case "44":
58-
$type = "telephone";
59-
break;
60-
case "6":
61-
$type = "email";
62-
break;
63-
case "96":
64-
$type = "vcard";
65-
break;
66-
}
39+
switch ($link->button_id) {
40+
case "1":
41+
$type = "link";
42+
break;
43+
case "2":
44+
$type = "link";
45+
break;
46+
case "43":
47+
$type = "spacer";
48+
$params = true;
49+
break;
50+
case "42":
51+
$type = "heading";
52+
$params = true;
53+
break;
54+
case "93":
55+
$type = "text";
56+
$params = true;
57+
break;
58+
case "44":
59+
$type = "telephone";
60+
break;
61+
case "6":
62+
$type = "email";
63+
break;
64+
case "96":
65+
$type = "vcard";
66+
break;
67+
}
6768
68-
// Update the link if a type was assigned
69-
if ($type !== null) {
70-
$link->type = $type;
71-
$link->save();
69+
if ($type !== null) {
70+
$link->type = $type;
71+
if ($params === true) {
72+
$link->type_params = json_encode(["custom_html" => true]);
7273
}
74+
$link->save();
7375
}
76+
}
7477
}

0 commit comments

Comments
 (0)