mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-02-17 20:41:00 +01:00
Expanded controller for custom icon
Expanded user controller to save the custom icon of individual buttons for the Button Editor. I wanted to put the saving part into its own controller, but I wasn't able to implement this because I couldn't put two controllers on one page via the route in web.php, and to my knowledge this is impossible. So I had to do some trickery to get this working. If I hadn't implemented the if-else statement, one value couldn't be saved without a NULL error violation. This will be used to display a custom icon via Font Awesome. See: https://blog.littlelink-custom.com/upcoming-features/ And: https://blog.littlelink-custom.com/progress-of-the-new-button-editor/
This commit is contained in:
parent
978add4b7b
commit
53805444aa
@ -201,7 +201,7 @@ class UserController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Show custom CSS
|
//Show custom CSS + custom icon
|
||||||
public function showCSS(request $request)
|
public function showCSS(request $request)
|
||||||
{
|
{
|
||||||
$linkId = $request->id;
|
$linkId = $request->id;
|
||||||
@ -226,7 +226,6 @@ class UserController extends Controller
|
|||||||
'link' => 'required',
|
'link' => 'required',
|
||||||
'title' => 'required',
|
'title' => 'required',
|
||||||
'button' => 'required',
|
'button' => 'required',
|
||||||
//'custom_css' => 'required',
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (stringStartsWith($request->link,'http://') == 'true' or stringStartsWith($request->link,'https://') == 'true' or stringStartsWith($request->link,'mailto:') == 'true')
|
if (stringStartsWith($request->link,'http://') == 'true' or stringStartsWith($request->link,'https://') == 'true' or stringStartsWith($request->link,'mailto:') == 'true')
|
||||||
@ -241,7 +240,6 @@ class UserController extends Controller
|
|||||||
$order = $request->order;
|
$order = $request->order;
|
||||||
$button = $request->button;
|
$button = $request->button;
|
||||||
$linkId = $request->id;
|
$linkId = $request->id;
|
||||||
//$custom_css = $request->custom_css;
|
|
||||||
|
|
||||||
$buttonId = Button::select('id')->where('name' , $button)->value('id');
|
$buttonId = Button::select('id')->where('name' , $button)->value('id');
|
||||||
|
|
||||||
@ -250,18 +248,20 @@ class UserController extends Controller
|
|||||||
return redirect('/studio/links');
|
return redirect('/studio/links');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save edit custom CSS
|
//Save edit custom CSS + custom icon
|
||||||
public function editCSS(request $request)
|
public function editCSS(request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
|
||||||
'custom_css' => 'required',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$linkId = $request->id;
|
$linkId = $request->id;
|
||||||
|
$custom_icon = $request->custom_icon;
|
||||||
$custom_css = $request->custom_css;
|
$custom_css = $request->custom_css;
|
||||||
|
|
||||||
|
if ($request->custom_css == "" and $request->custom_icon =! "") {
|
||||||
|
Link::where('id', $linkId)->update(['custom_icon' => $custom_icon]);
|
||||||
|
} elseif ($request->custom_icon == "" and $request->custom_css =! "") {
|
||||||
Link::where('id', $linkId)->update(['custom_css' => $custom_css]);
|
Link::where('id', $linkId)->update(['custom_css' => $custom_css]);
|
||||||
|
} else {
|
||||||
|
Link::where('id', $linkId)->update([]);
|
||||||
|
}
|
||||||
return header("Refresh:0");
|
return header("Refresh:0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user