Skip to content

Instantly share code, notes, and snippets.

Nuno Maduro nunomaduro

View GitHub Profile
View scout_extended_facades_client.php
<?php
use Algolia\ScoutExtended\Facades\Algolia;
$client = Algolia::client();
$apiKeys = $client->listApiKeys();
$indices = $client->listIndices();
$client->copyIndex('indexNameSrc', 'indexNameDest');
$client->moveIndex('indexNameSrc', 'indexNameDest');
View scout_extended_facades_analytics.php
<?php
use Algolia\ScoutExtended\Facades\Algolia;
$analytics = Algolia::analytics();
$test = $analytics->getABTest('a-unique-identifier');
// ...
View scout_extended_facade_client.php
<?php
use Algolia\ScoutExtended\Facades\Algolia;
$client = Algolia::client();
$apiKeys = $client->listApiKeys();
$indices = $client->listIndices();
$client->copyIndex('indexNameSrc', 'indexNameDest');
$client->moveIndex('indexNameSrc', 'indexNameDest');
View scout_extended_settings_file.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Searchable Attributes
|--------------------------------------------------------------------------
|
| Limits the scope of a search to the attributes listed in this setting. Defining
View scout_extended_with.php
<?php
$articles = Article::search('Star Trek')
->with([
'hitsPerPage' => 30,
'filters' => 'attribute:value',
'typoTolerance' => false,
])->get();
View scout_extended_around_lat_lng.php
<?php
$articles = Article::search('query')
->aroundLatLng(48.8588536, 2.3125377)
->get();
View scout_extended_where_between.php
<?php
$products = Products::search('Star Trek')
->whereBetween('price', [100, 200])
->get();
View scout_extended_where.php
<?php
$articles = Article::search('Star Trek')->where('views', '>', 100)->get();
$articles = Article::search('Star Trek')->where('created_at', '>=', now()->subDays(7))->get();
$articles = Article::search('Star Trek')->where('views', 100)->get(); // views = 100
View searching_aggregators.php
<?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":[
View AppServiceProvider.php
<?php
namespace App\Providers;
use App\Search\News;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.