Fixed saving logic for custom buttons
This commit is contained in:
parent
cab5e4193c
commit
1abab3fd40
|
@ -195,13 +195,16 @@ class UserController extends Controller
|
||||||
$LinkURL = $request->link;
|
$LinkURL = $request->link;
|
||||||
|
|
||||||
// Step 3: Load Link Type Logic
|
// Step 3: Load Link Type Logic
|
||||||
if($request->typename == 'predefined') {
|
if($request->typename == 'predefined' || $request->typename == 'link') {
|
||||||
$button = Button::where('name', $request->button)->first();
|
// Determine button id based on whether a custom or predefined button is used
|
||||||
|
$button_id = ($request->typename == 'link') ? ($request->GetSiteIcon == 1 ? 2 : 1) : null;
|
||||||
|
$button = ($request->typename != 'link') ? Button::where('name', $request->button)->first() : null;
|
||||||
|
|
||||||
$linkData = [
|
$linkData = [
|
||||||
'link' => $LinkURL,
|
'link' => $LinkURL,
|
||||||
'title' => $LinkTitle ?? $button?->alt,
|
'title' => $LinkTitle ?? $button?->alt,
|
||||||
'user_id' => Auth::user()->id,
|
'user_id' => Auth::user()->id,
|
||||||
'button_id' => $button?->id,
|
'button_id' => $button?->id ?? $button_id,
|
||||||
'type' => $request->typename // Save the link type
|
'type' => $request->typename // Save the link type
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue