This listener provides search capabilities for the Crud plugin.
The Search listener
depends on the FriendsOfCake
repo search
.
[Please also see the repo] (https://github.com/FriendsOfCake/search)
You need to install FriendsOfCake/Search first.
Attach it on the fly in your controller beforeFilter, this is recommended if you want to attach it only to specific controllers and actions:
<?php
class SamplesController extends AppController {
public function beforeFilter(\Cake\Event\Event $event) {
$this->Crud->addListener('Crud.Search');
parent::beforeFilter();
}
}
?>
Attach it using components array, this is recommended if you want to attach it to all controllers, application wide:
<?php
class SamplesController extends AppController {
public $components = [
'Crud.Crud' => [
'actions' => ['index', 'view'],
'listeners' => ['Crud.Search']
];
}
?>