PHP code example of elstc / cakephp-restore-query
1. Go to this page and download the library: Download elstc/cakephp-restore-query 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/ */
elstc / cakephp-restore-query example snippets
class AppController extends Controller
{
public function initialize()
{
$this->loadComponent('Elastic/RestoreQuery.RestoreQuery', [
'actions' => ['index', 'search'], // List of actions to record query string
]);
}
}
<?=
$this->Html->link('link text', [
'action' => 'index',
'?' => ['_restore' => true], // NOTE: _restore=true, the component will restore the saved query.
]);