Has many: display regions with 1 or more elements
I have relationship between adv and region model. Actually I want to display all regions which has one or more active adv (I have active column into adv). And next similar problem. All regions contain cities. When user choose some region into view he saw all cities from this region. What is the best way to do that?
I won’t write manually every cities. I have 2 ideas:
-
first cities will be string column. Actually user will choose region and write name of city into input field.
-
controller will check that this city exist with this region. If not, it’ll create a new.
I think that second idea is better because create search engine and filter results will be simpler.
from Laravel Questions and Answers https://laravelquestions.com/laravel/has-many-display-regions-with-1-or-more-elements/
via Lzo Media
No comments:
Post a Comment