PHP code example of babenkoivan / elastic-scout-driver

1. Go to this page and download the library: Download babenkoivan/elastic-scout-driver 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/ */

    

babenkoivan / elastic-scout-driver example snippets


// config/scout.php

'driver' => env('SCOUT_DRIVER', 'elastic'),

$orders = App\Order::search('title:(Star OR Trek)')->get();

$orders = App\Order::search()->where('user_id', 1)->get();

public function shouldBeSearchable()
{
    return count($this->toSearchableArray()) > 0;
}

$searchResult = App\Order::search('Star Trek')->raw();

App\Order::search('Star Trek', function () {
    // this will not be triggered
})->get()
bash
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
bash
php artisan vendor:publish --provider="Elastic\Client\ServiceProvider"
bash
php artisan vendor:publish --provider="Elastic\ScoutDriver\ServiceProvider"