Skip to content

Commit abb463e

Browse files
committed
Added controller to save custom CSS
Added controller to display and save custom CSS on the edit-link page. See: https://blog.littlelink-custom.com/upcoming-features/
1 parent a53087f commit abb463e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/Http/Controllers/UserController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,12 @@ public function showLink(request $request)
192192
$link = Link::where('id', $linkId)->value('link');
193193
$title = Link::where('id', $linkId)->value('title');
194194
$order = Link::where('id', $linkId)->value('order');
195+
$custom_css = Link::where('id', $linkId)->value('custom_css');
195196
$buttonId = Link::where('id', $linkId)->value('button_id');
196197

197198
$buttons = Button::select('id', 'name')->get();
198199

199-
return view('studio/edit-link', ['buttonId' => $buttonId, 'buttons' => $buttons, 'link' => $link, 'title' => $title, 'order' => $order, 'id' => $linkId]);
200+
return view('studio/edit-link', ['custom_css' => $custom_css, 'buttonId' => $buttonId, 'buttons' => $buttons, 'link' => $link, 'title' => $title, 'order' => $order, 'id' => $linkId]);
200201

201202
}
202203

@@ -207,6 +208,7 @@ public function editLink(request $request)
207208
'link' => 'required',
208209
'title' => 'required',
209210
'button' => 'required',
211+
'custom_css' => 'required',
210212
]);
211213

212214
if (stringStartsWith($request->link,'http://') == 'true' or stringStartsWith($request->link,'https://') == 'true' or stringStartsWith($request->link,'mailto:') == 'true')
@@ -221,10 +223,11 @@ public function editLink(request $request)
221223
$order = $request->order;
222224
$button = $request->button;
223225
$linkId = $request->id;
226+
$custom_css = $request->custom_css;
224227

225228
$buttonId = Button::select('id')->where('name' , $button)->value('id');
226229

227-
Link::where('id', $linkId)->update(['link' => $link, 'title' => $title, 'order' => $order, 'button_id' => $buttonId]);
230+
Link::where('id', $linkId)->update(['link' => $link, 'title' => $title, 'order' => $order, 'button_id' => $buttonId, 'custom_css' => $custom_css]);
228231

229232
return redirect('/studio/links');
230233
}

0 commit comments

Comments
 (0)