fixed indexing of Producers model

This commit is contained in:
pushrbx 2024-01-31 19:40:38 +00:00
parent 7ba31ce91f
commit 28a2dbdcaa

View File

@ -59,11 +59,13 @@ class Producers extends JikanApiSearchableModel
public function toSearchableArray(): array
{
$titles = !is_null($this->titles) ? collect($this->titles)->map(fn ($x) => $x["title"])->toArray() : [''];
return [
'id' => (string) $this->mal_id,
'mal_id' => (int) $this->mal_id,
'url' => !is_null($this->url) ? $this->url : '',
'titles' => !is_null($this->titles) ? collect($this->titles)->map(fn ($x) => $x["title"])->toArray() : [''],
'titles' => implode(', ', $titles),
'established' => $this->convertToTimestamp($this->established),
'favorites' => $this->favorites,
'count' => $this->count
@ -80,6 +82,6 @@ class Producers extends JikanApiSearchableModel
public function getTitleAttributeName(): string
{
return 'titles';
return 'titles_idx';
}
}