1/16/2024 0 Comments Band in a box lyrics tutorialHere’s how we do it: artist -> genres ) ) return array_merge ( $this -> toArray ( ), ) } public function artist ( ) ) ) By default, the toSearchableArray() method returns the $this->toArray() output as our index object (when sending the index record to Algolia), whereas we need additional data, like artist’s name, genres and the image URL, which reside in another table – the artists table. To do this, we override the toSearchableArray() method in the Song model (this method is added to the class by the Laravel\Scout\Searchable trait). On the other hand, we should join all the needed tables, preparing a customized JSON object before indexing. To work around this limitation, we should define a custom structure for our index records. Apart from that, the index is not a relational database, meaning when searching through the index, we cannot use complex where clauses or SQL joins.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |