public function formName()
{
return 's';
}
'data' => ['url' => Url::toRoute(['catalog/view', 'id' => $model->id])]];
public function createUrl($manager, $route, $params)
{
if ($route == $this->route . 'category' && isset($params['id'])) {
$cls = $this->classCategory;
$category = $cls::findOne($params['id']);
unset($params['id']);
$aliases = ArrayHelper::getColumn($category->ancestors()->select('alias')->asArray()->all(), 'alias');
unset($aliases[0]);
if ($category->level > 1) {
$aliases[] = $category->alias;
}
$url = $this->route . implode('/', $aliases) . $manager->suffix;
if (!empty($params) && ($query = http_build_query($params)) !== '') {
$url .= '?' . $query;
}
return $url;
}
public function rules()
{
return [
[
[
'center',
'radius',
'tab',
'period',
'type',
'category',
'region',
'street',
'district',
'priceMin',
'priceMax',
'material'
],
'safe'
]
];
}
public function getCategories()
{
if (is_array($this->_categories)) {
return $this->_categories;
}
$this->_categories[] = 'Вся недвижимость';
foreach (Category::findRoot()->children(1)->all() as $category) {
foreach ($category->children()->all() as $subCategory) {
$this->_categories[$category->name][$subCategory->id] = $subCategory->name;
}
}
return $this->_categories;
}
'catalog/online/<page:\d+>' => 'catalog/online',
'page' => 'catalog/online?page=6',
class Url extends BaseUrl
{
}
'<controller>/<action>' => '<controller>/<action>',
'/catalog/online/<category:\w+>' => '/catalog/online/?s%5Bcategory%5D=6'