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 44use Illuminate\Support\Facades\ DB ;
55use App\Models\ Link ;
66
7- // Disable execution time limit
87set_time_limit (0 );
98
109if (trim (file_get_contents (base_path (" version.json" ))) < ' 4.0.0' ){
1716} catch (Exception $e ) {}
1817}
1918
20- // Check version
2119if (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
2421if (! Schema:: hasColumn (' links' , ' type' )) {
2522 Schema:: table (' links' , function (Blueprint $table ) {
2623 $table -> string (' type' )-> nullable ();
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}
You can’t perform that action at this time.
0 commit comments