1
0
mirror of https://github.com/Kovah/LinkAce.git synced 2025-02-24 03:03:55 +01:00

Tags and lists are now properly removed if the form returns no values (#99)

This commit is contained in:
Kovah 2020-04-07 17:02:39 +02:00
parent 1b5ae67b41
commit 1f50ecb7f9
No known key found for this signature in database
GPG Key ID: AAAA031BA9830D7B

View File

@ -66,10 +66,14 @@ class LinkRepository
if (isset($data['tags'])) {
self::updateTagsForLink($link, $data['tags']);
} else {
$link->tags()->detach();
}
if (isset($data['lists'])) {
self::updateListsForLink($link, $data['lists']);
} else {
$link->lists()->detach();
}
return $link;
@ -101,10 +105,6 @@ class LinkRepository
*/
protected static function updateTagsForLink(Link $link, string $tags): void
{
if (empty($tags)) {
return;
}
$parsedTags = explode(',', $tags);
$newTags = [];
@ -128,10 +128,6 @@ class LinkRepository
*/
protected static function updateListsForLink(Link $link, string $lists): void
{
if (empty($lists)) {
return;
}
$parsedLists = explode(',', $lists);
$newLists = [];