File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -195,13 +195,16 @@ public function saveLink(Request $request)
195
195
$ LinkURL = $ request ->link ;
196
196
197
197
// Step 3: Load Link Type Logic
198
- if ($ request ->typename == 'predefined ' ) {
199
- $ button = Button::where ('name ' , $ request ->button )->first ();
198
+ if ($ request ->typename == 'predefined ' || $ request ->typename == 'link ' ) {
199
+ // Determine button id based on whether a custom or predefined button is used
200
+ $ button_id = ($ request ->typename == 'link ' ) ? ($ request ->GetSiteIcon == 1 ? 2 : 1 ) : null ;
201
+ $ button = ($ request ->typename != 'link ' ) ? Button::where ('name ' , $ request ->button )->first () : null ;
202
+
200
203
$ linkData = [
201
204
'link ' => $ LinkURL ,
202
205
'title ' => $ LinkTitle ?? $ button ?->alt,
203
206
'user_id ' => Auth::user ()->id ,
204
- 'button_id ' => $ button ?->id,
207
+ 'button_id ' => $ button ?->id ?? $ button_id ,
205
208
'type ' => $ request ->typename // Save the link type
206
209
];
207
210
} else {
You can’t perform that action at this time.
0 commit comments