Skip to content

Commit 759e859

Browse files
committed
Fixed link type always defaulting to link when editing
1 parent b9922a3 commit 759e859

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/Http/Controllers/UserController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,15 @@ public function AddUpdateLink($id = 0)
121121
$data['LinkTypes'] = LinkType::get();
122122
$data['LinkData'] = $linkData;
123123
$data['LinkID'] = $id;
124-
$data['title'] = "link";
125124
$data['linkTypeID'] = "1";
125+
$data['title'] = "Custom Link";
126126

127127
if (Route::currentRouteName() != 'showButtons') {
128128
$links = DB::table('links')->where('id', $id)->first();
129129

130130
$bid = $links->button_id;
131-
131+
132+
132133
if($bid == 1 or $bid == 2){
133134
$data['linkTypeID'] = "1";
134135
} elseif ($bid == 42) {
@@ -138,6 +139,8 @@ public function AddUpdateLink($id = 0)
138139
} else {
139140
$data['linkTypeID'] = "2";
140141
}
142+
143+
$data['title'] = LinkType::where('id', $data['linkTypeID'])->value('title');
141144
}
142145

143146
foreach ($data['LinkTypes']->toArray() as $key => $val) {

resources/views/studio/edit-link.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<div class="form-group col-lg-8 flex justify-around">
1616
<label class='font-weight-bold'>Link Type: </label>
1717
<div class="btn-group shadow m-2">
18-
<button type="button" id='btnLinkType' class="border-0 p-1" title='Click to change link type' data-toggle="modal" data-target="#SelectLinkType">link</button>
18+
<button type="button" id='btnLinkType' class="border-0 p-1" title='Click to change link type' data-toggle="modal" data-target="#SelectLinkType">{{$title}}</button>
1919

2020

2121

0 commit comments

Comments
 (0)