mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 05:00:49 +08:00
add scout
This commit is contained in:
@@ -3,9 +3,13 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Repositories\TagRepository;
|
||||
use JeroenG\Explorer\Application\Explored;
|
||||
use Laravel\Scout\Searchable;
|
||||
|
||||
class Torrent extends NexusModel
|
||||
class Torrent extends NexusModel implements Explored
|
||||
{
|
||||
use Searchable;
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'filename', 'save_as', 'descr', 'small_descr', 'ori_descr',
|
||||
'category', 'source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec',
|
||||
@@ -71,6 +75,32 @@ class Torrent extends NexusModel
|
||||
self::PROMOTION_ONE_THIRD_DOWN => ['text' => '30%', 'up_multiplier' => 1, 'down_multiplier' => 0.3],
|
||||
];
|
||||
|
||||
public function mappableAs(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'long',
|
||||
'name' => 'text',
|
||||
'descr' => 'text',
|
||||
'source' => 'long',
|
||||
'leechers' => 'long',
|
||||
'seeders' => 'long',
|
||||
'added' => 'date',
|
||||
];
|
||||
}
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'descr' => $this->descr,
|
||||
'source' => $this->source,
|
||||
'leechers' => $this->leechers,
|
||||
'seeders' => $this->seeders,
|
||||
'added' => $this->added,
|
||||
];
|
||||
}
|
||||
|
||||
public function getSpStateRealTextAttribute()
|
||||
{
|
||||
$spStateReal = $this->sp_state_real;
|
||||
|
||||
Reference in New Issue
Block a user