PHP code example of thedoctor0 / laravel-scout-sonic
1. Go to this page and download the library: Download thedoctor0/laravel-scout-sonic library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
thedoctor0 / laravel-scout-sonic example snippets
public function toSearchableArray()
{
return array_filter([$this->display_name, $this->first_name, $this->last_name]);
}
// an ISO 639-3 locale code eg. eng for English (if set, the locale must be a valid ISO 639-3 code; if set to none, lexing will be disabled; if not set, the locale will be guessed from text)
public function getSonicLocale() {
return 'none';
}
/*
* Package Service Providers...
*/
james2doyle\SonicScout\Providers\SonicScoutServiceProvider::class,
/*
|--------------------------------------------------------------------------
| Sonic Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your Sonic settings.
|
*/
'sonic' => [
'address' => \env('SONIC_ADDRESS', 'localhost'),
'port' => \env('SONIC_PORT', 1491),
'password' => \env('SONIC_PASSWORD'),
'connection_timeout' => \env('SONIC_CONNECTION_TIMEOUT', 10),
'read_timeout' => \env('SONIC_READ_TIMEOUT', 5)
],
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.