V
V
Valeriy Donika2015-02-16 12:52:38
MySQL
Valeriy Donika, 2015-02-16 12:52:38

Yii2 region selection (region) how to solve this?

Good afternoon.
The structure is
Table City
--------
city_id
city_name
slug
default
-------
Shop
------
shop_id
shop_name
slug
city_id
------
Product
-------
product_id
slug
name
city_id
image
shop_id
status
category_id
description
user_id
---------
What we would like, select the region on the main page and then all the urls site.com/odessa/shop/adidas
site.com/odessa/shoes/ecco
Etc. I understand that this is something like multilingualism, I looked at examples of multilingualism, there are all sorts of Yii::$app->language , and I have one language, I'm generally confused.
Please advise if anyone has experience with this issue :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander N++, 2015-02-16
@sanchezzzhak

In your case, there is no multilingualism, make the rule in the route and the method in the controller.
show method in Shop controller

public function actionShow($region, $brend){
  //...
}

For grouping www.yiiframework.com/doc-2.0/yii-web-groupurlrule.html I didn’t understand how it works, but it’s analogous as in laravel Route::group
In general, bind to a part of the url that will not change.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question