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

@@ -117,19 +117,19 @@ class Pages
return !count($errors);
}
static public function toggleHidden($id, &$errors, &$status)
static public function toggleHide($id, &$errors, &$status)
{
if (isset($id)) {
$row = ModelsPages::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 Page.';
$errors[] = 'Fail during toggle hide Page.';
}
else {
clearRouteCache();
}
$status = $row->hidden;
$status = $row->hide;
}
else {
$errors[] = 'Page with id ' . $id . ' does not exists.';

View File

@@ -88,17 +88,17 @@ class Changelog
return true;
}
static public function toggleHidden($id, &$errors, &$status)
static public function toggleHide($id, &$errors, &$status)
{
if(isset($id))
{
$row = ModelsChangelog::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 Changelog.';
$errors[] = 'Fail during toggle hide Changelog.';
}
$status = $row->hidden;
$status = $row->hide;
} else {
$errors[] = 'Changelog with id ' . $id . ' does not exists.';
}

View File

@@ -155,14 +155,14 @@ class Forum
return !count($errors);
}
public static function toggleHidden_board($id, &$errors)
public static function toggleHide_board($id, &$errors)
{
global $db;
if(isset($id))
{
$query = self::get_board($id);
if($query !== false)
$db->update(TABLE_PREFIX . 'forum_boards', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id));
$db->update(TABLE_PREFIX . 'forum_boards', array('hide' => ($query['hide'] == 1 ? 0 : 1)), array('id' => $id));
else
$errors[] = 'Forum board with id ' . $id . ' does not exists.';
}

View File

@@ -11,6 +11,6 @@ class Changelog extends Model {
public $timestamps = false;
public function scopeIsPublic($query) {
$query->where('hidden', '!=', 1);
$query->where('hide', '!=', 1);
}
}

View File

@@ -10,5 +10,5 @@ class FAQ extends Model {
public $timestamps = false;
protected $fillable = ['question', 'answer', 'ordering', 'hidden'];
protected $fillable = ['question', 'answer', 'ordering', 'hide'];
}

View File

@@ -12,7 +12,7 @@ class News extends Model {
protected $fillable = [
'title', 'body', 'type', 'date', 'category', 'player_id',
'last_modified_by', 'last_modified_date', 'comments', 'article_text',
'article_image', 'hidden'
'article_image', 'hide'
];
public function player()

View File

@@ -9,13 +9,13 @@ class Pages extends Model {
public $timestamps = false;
protected $fillable = ['name', 'title', 'body', 'date', 'player_id', 'php', 'enable_tinymce', 'access', 'hidden'];
protected $fillable = ['name', 'title', 'body', 'date', 'player_id', 'php', 'enable_tinymce', 'access', 'hide'];
protected $casts = [
'player_id' => 'integer',
'enable_tinymce' => 'integer',
'access' => 'integer',
'hidden' => 'integer',
'hide' => 'integer',
];
public function player()
@@ -24,7 +24,7 @@ class Pages extends Model {
}
public function scopeIsPublic($query) {
$query->where('hidden', '!=', 1);
$query->where('hide', '!=', 1);
}
}

View File

@@ -101,18 +101,18 @@ class News
return true;
}
static public function toggleHidden($id, &$errors, &$status)
static public function toggleHide($id, &$errors, &$status)
{
if(isset($id))
{
$row = ModelsNews::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 News.';
$errors[] = 'Fail during toggle hide News.';
}
$status = $row->hidden;
$status = $row->hide;
}
else
$errors[] = 'News with id ' . $id . ' does not exists.';

View File

@@ -81,7 +81,7 @@ class Spells {
'conjure_count' => $spell->getConjureCount(),
'conjure_id' => $spell->getConjureId(),
'reagent' => $spell->getReagentId(),
'hidden' => $spell->isEnabled() ? 0 : 1
'hide' => $spell->isEnabled() ? 0 : 1
));
if($show) {
@@ -121,7 +121,7 @@ class Spells {
'premium' => $spell->isPremium() ? 1 : 0,
'vocations' => json_encode($spell->getVocations()),
'conjure_count' => 0,
'hidden' => $spell->isEnabled() ? 0 : 1
'hide' => $spell->isEnabled() ? 0 : 1
));
if($show) {
@@ -159,7 +159,7 @@ class Spells {
'vocations' => json_encode($spell->getVocations()),
'conjure_count' => 0,
'item_id' => $spell->getID(),
'hidden' => $spell->isEnabled() ? 0 : 1
'hide' => $spell->isEnabled() ? 0 : 1
));
if($show) {