PHP code example of pomirleanu / eloquent-elastic

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

    

pomirleanu / eloquent-elastic example snippets


  /*
    |--------------------------------------------------------------------------
    | Autoloaded Service Providers
    |--------------------------------------------------------------------------
    |
  */
  'providers' => [
    ...
    \Elodex\IndexServiceProvider::class,
  ],

  /*
    |--------------------------------------------------------------------------
    | Default Index Name
    |--------------------------------------------------------------------------
    |
  */
  'default_index' => 'my_app_index',



namespace App;

use Illuminate\Database\Eloquent\Model as BaseModel;
use Elodex\Contracts\IndexedModel as IndexedModelContract;
use Elodex\IndexedModel as IndexedModelTrait;

class Model extends BaseModel implements IndexedModelContract
{
    use IndexedModelTrait;

$repository = User::getClassIndexRepository();

$client = app('elodex.client');

  ->getModels()
  

     protected $elastic_cache_prefix = 'cache_prefix_';
 
bash
$ php artisan vendor:publish --provider="Elodex\IndexServiceProvider"