1. Go to this page and download the library: Download fabrazer/yii2-helpers 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/ */
fabrazer / yii2-helpers example snippets
public function rules()
{
$rules = [
// Your rules
];
// Add rules of the relations "city" and "country"
$this->enableRelatedModelSearchRules(['city', 'country'], $rules);
return $rules;
}
public function attributes()
{
// Add attributes of the relations "city" and "country"
return $this->enableRelatedModelSearchAttributes(['city', 'country'], parent::attributes());
}
public function search($params)
{
// Your code ...
// Add sorting and filtering to the query
$this->enableRelatedModelSearch(['city', 'country'], $dataProvider);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.