File tree Expand file tree Collapse file tree 1 file changed +37
-34
lines changed
resources/views/components Expand file tree Collapse file tree 1 file changed +37
-34
lines changed Original file line number Diff line number Diff line change 4
4
use Illuminate\Support\Facades\ DB ;
5
5
use App\Models\ Link ;
6
6
7
- // Disable execution time limit
8
7
set_time_limit (0 );
9
8
10
9
if (trim (file_get_contents (base_path (" version.json" ))) < ' 4.0.0' ){
17
16
} catch (Exception $e ) {}
18
17
}
19
18
20
- // Check version
21
19
if (trim (file_get_contents (base_path (" version.json" ))) < ' 4.8.1' ) {
22
20
23
- // First, check if the 'type' and 'type_params' columns exist, and add them if they don't
24
21
if (! Schema:: hasColumn (' links' , ' type' )) {
25
22
Schema:: table (' links' , function (Blueprint $table ) {
26
23
$table -> string (' type' )-> nullable ();
33
30
});
34
31
}
35
32
36
- // Get all links
37
33
$links = Link:: all ();
38
34
39
35
foreach ($links as $link ) {
40
- $type = null ;
36
+ $type = null ;
37
+ $params = false ;
41
38
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
+ }
67
68
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 ] );
72
73
}
74
+ $link -> save ();
73
75
}
76
+ }
74
77
}
You can’t perform that action at this time.
0 commit comments