Files
nexusphp/app/Models/SearchBox.php

47 lines
1.4 KiB
PHP
Raw Normal View History

2021-05-20 17:14:38 +08:00
<?php
namespace App\Models;
2021-05-20 23:30:34 +08:00
class SearchBox extends NexusModel
2021-05-20 17:14:38 +08:00
{
protected $table = 'searchbox';
protected $fillable = [
'name', 'catsperrow', 'catpadding', 'showsubcat',
'showsource', 'showmedium', 'showcodec', 'showstandard', 'showprocessing', 'showteam', 'showaudiocodec',
2022-09-02 19:49:41 +08:00
'custom_fields', 'custom_fields_display_name', 'custom_fields_display', 'extra'
2021-05-20 17:14:38 +08:00
];
2022-09-02 19:49:41 +08:00
protected $casts = [
'extra' => 'object'
];
const EXTRA_DISPLAY_COVER_ON_TORRENT_LIST = 'display_cover_on_torrent_list';
2022-09-06 21:54:13 +08:00
const EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST = 'display_seed_box_icon_on_torrent_list';
2022-09-02 19:49:41 +08:00
public static array $extras = [
self::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => ['text' => 'Display cover on torrent list'],
2022-09-06 21:54:13 +08:00
self::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => ['text' => 'Display seed box icon on torrent list'],
2022-09-02 19:49:41 +08:00
];
public static function listExtraText(): array
{
$result = [];
foreach (self::$extras as $extra => $info) {
$result[$extra] = nexus_trans("searchbox.extras.$extra");
}
return $result;
}
2021-05-20 23:30:34 +08:00
public function categories(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(Category::class, 'mode');
}
public function normal_fields(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(SearchBoxField::class, 'searchbox_id');
}
2021-05-20 17:14:38 +08:00
}