Skip to content

Commit c0a8c41

Browse files
committed
Added controller for button editor
Added controller to display and edit custom CSS for the upcoming button editor. See: https://blog.littlelink-custom.com/upcoming-features/
1 parent cb4de3f commit c0a8c41

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

app/Http/Controllers/UserController.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,23 @@ public function showLink(request $request)
201201

202202
}
203203

204+
//Show custom CSS
205+
public function showCSS(request $request)
206+
{
207+
$linkId = $request->id;
208+
209+
$link = Link::where('id', $linkId)->value('link');
210+
$title = Link::where('id', $linkId)->value('title');
211+
$order = Link::where('id', $linkId)->value('order');
212+
$custom_css = Link::where('id', $linkId)->value('custom_css');
213+
$buttonId = Link::where('id', $linkId)->value('button_id');
214+
215+
$buttons = Button::select('id', 'name')->get();
216+
217+
return view('studio/button-editor', ['custom_css' => $custom_css, 'buttonId' => $buttonId, 'buttons' => $buttons, 'link' => $link, 'title' => $title, 'order' => $order, 'id' => $linkId]);
218+
219+
}
220+
204221
//Save edit link
205222
public function editLink(request $request)
206223
{
@@ -232,6 +249,21 @@ public function editLink(request $request)
232249
return redirect('/studio/links');
233250
}
234251

252+
//Save edit custom CSS
253+
public function editCSS(request $request)
254+
{
255+
$request->validate([
256+
'custom_css' => 'required',
257+
]);
258+
259+
$linkId = $request->id;
260+
$custom_css = $request->custom_css;
261+
262+
Link::where('id', $linkId)->update(['custom_css' => $custom_css]);
263+
264+
return header("Refresh:0");
265+
}
266+
235267
//Show littlelinke page for edit
236268
public function showPage(request $request)
237269
{

0 commit comments

Comments
 (0)