2022-09-06 20:45:29 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2022-09-19 16:27:04 +08:00
|
|
|
use Nexus\Database\NexusDB;
|
2022-09-06 20:45:29 +08:00
|
|
|
|
|
|
|
|
class TorrentCustomField extends NexusModel
|
|
|
|
|
{
|
|
|
|
|
protected $table = 'torrents_custom_fields';
|
|
|
|
|
|
2022-11-26 13:24:30 +08:00
|
|
|
public $timestamps = true;
|
|
|
|
|
|
2022-09-06 20:45:29 +08:00
|
|
|
protected $fillable = [
|
2022-10-25 19:16:56 +08:00
|
|
|
'name', 'label', 'type', 'required', 'is_single_row', 'options', 'help', 'display', 'priority'
|
2022-09-06 20:45:29 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public static function getCheckboxOptions(): array
|
|
|
|
|
{
|
|
|
|
|
$result = [];
|
|
|
|
|
$records = self::query()->get();
|
|
|
|
|
foreach ($records as $value) {
|
|
|
|
|
$result[$value->id] = sprintf('%s[%s]', $value->name, $value->label);
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
2022-09-19 16:27:04 +08:00
|
|
|
|
2022-09-06 20:45:29 +08:00
|
|
|
}
|