PHP code example of harlan-zw / laravel-swiftype

1. Go to this page and download the library: Download harlan-zw/laravel-swiftype 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/ */

    

harlan-zw / laravel-swiftype example snippets


/** @var \Loonpwn\Swiftype\Clients\Api $api */
$api = app(Swiftype::class);

/**
 * Should model changes be pushed to Swiftype. Excludes deleting
 * @return bool
 */
public function shouldSyncSwiftypeOnSave()
{
    // by default all model changes are pushed to swiftype
    return true;
}

/**
 * Get the mapped attribute values for Swiftype
 * @return mixed|null
 */
public function getSwiftypeAttributes()
{
    // Document transformer is the default transformer, feel free to implement your own
    return transform($this, new DocumentTransformer());
}