Files
nexusphp/app/Models/TorrentExtra.php
2025-05-16 02:43:45 +07:00

32 lines
683 B
PHP

<?php
namespace App\Models;
use Nexus\Database\NexusDB;
use Nexus\Torrent\TechnicalInformation;
class TorrentExtra extends NexusModel
{
public $timestamps = true;
protected $fillable = ['torrent_id', 'descr', 'ori_descr', 'media_info', 'nfo', 'pt_gen'];
protected $casts = [
'pt_gen' => 'array',
];
public function torrent()
{
return $this->belongsTo(Torrent::class, 'torrent_id');
}
protected $appends = ['media_info_summary'];
public function getMediaInfoSummaryAttribute(): array
{
$technicalInfo = new TechnicalInformation($this->media_info ?? '');
return $technicalInfo->getSummaryInfo();
}
}