1. Go to this page and download the library: Download liqueurdetoile/cakephp-fuse 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/ */
// In the initialize method of the model
$this
->addBehavior('Lqdt/CakephpFuse.Fuse')
->setSearchableFields(['name'])
->setOptions(['threshold' => 0.2]);
// or
$this
->addBehavior('Lqdt/CakephpFuse.Fuse')
->setOptions([
'keys' => ['name'],
'threshold' => 0.2
]);
// or
$this->addBehavior('Lqdt/CakephpFuse.Fuse', [
'keys' => ['name'],
'threshold' => 0.2
]);
// Assuming Items belongsTo Owners, with owner as property and name as string field
$query = $this->Items->fuse('test', ['keys' => ['name', 'owner.name']])->contain(['Owners']);
// Assuming Owners also belongsTo Services, with service as property and name as string field
$query = $this->Items->fuse('test', ['keys' => ['name', 'owner.service.name']])->contain(['Owners', 'Owners.Services']);
// Will search any string fields in Items, Owners and Services
$query = $this->Items->fuse('test')->contain(['Owners', 'Owners.Services']);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.