Change hidden to hide (Eloquent blocked keyword)

This commit is contained in:
slawkens
2024-01-27 16:54:48 +01:00
parent 3554b41172
commit d71bab648d
48 changed files with 143 additions and 122 deletions

View File

@@ -48,7 +48,7 @@ if($canEdit) {
$action = $comment = $image = $author = '';
}
} else if ($action == 'hide') {
Gallery::toggleHidden($id, $errors);
Gallery::toggleHide($id, $errors);
} else if ($action == 'moveup') {
Gallery::move($id, -1, $errors);
} else if ($action == 'movedown') {
@@ -107,9 +107,9 @@ if(isset($_GET['image']))
$images = Cache::remember('gallery_' . ($canEdit ? '1' : '0'), 60, function () use ($db, $canEdit) {
return $db->query('SELECT `id`, `comment`, `image`, `author`, `thumb`' .
($canEdit ? ', `hidden`, `ordering`' : '') .
($canEdit ? ', `hide`, `ordering`' : '') .
' FROM `' . TABLE_PREFIX . 'gallery`' .
(!$canEdit ? ' WHERE `hidden` != 1' : '') .
(!$canEdit ? ' WHERE `hide` != 1' : '') .
' ORDER BY `ordering`;')->fetchAll(PDO::FETCH_ASSOC);
});
@@ -204,15 +204,15 @@ class Gallery
return !count($errors);
}
static public function toggleHidden($id, &$errors)
static public function toggleHide($id, &$errors)
{
if(isset($id))
{
$row = ModelsGallery::find($id);
if($row) {
$row->hidden = $row->hidden == 1 ? 0 : 1;
$row->hide = $row->hide == 1 ? 0 : 1;
if (!$row->save()) {
$errors[] = 'Fail during toggle hidden Gallery';
$errors[] = 'Fail during toggle hide Gallery';
}
} else
$errors[] = 'Image with id ' . $id . ' does not exists.';