Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Searching aggregators
<?php
$models = App\Search\News::search('Star Trek')->get();
echo get_class($models[0]); // "App\Article"
echo get_class($models[1]); // "App\Comment"
$results = App\Search\News::search('Star Trek')->raw();
/*
{
"hits":[
{
"id":1,
"title": "Article title",
"slug": "article-title",
"content": "Article content",
"objectID":"App\\Article::1",
...
},
{
"id": 1,
"content": "Comment content",
"objectID": "App\\Comment::1",
...
},
],
...
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.