This is the situation:
-) I’ve an advanced template. Frontend side a user have his area (behind login) in which manage informations about his own company and RELATED informations, specifically reviews. So, db side i’ve a one to many relation between companies table and reviews table (id => company_id)
-) I would like to let the user access his own "company/reviews/index" area in which show a grid containing only the reviews related to his company.
I’m trying to use the CompanyReviewSearch Model generated by Gii but i don’t know how to say to it "each time you perform a search, set as default the parameter company_id.
The other question is: i don’t want to pass the company_id parameter through the url, i would like to hide it. I think it’s possible cause only logged in users can view their own company/reviews/index page, and i can found the company_id parameter through the user_id, cause i’ve a one to one relation through “companies” table and “users” table.
Note: just to know what best practice should i follow. I’ve a “company” controller and a “CompanyReview” controller. Do you think its better to place the “index” action within “CompanyReview” controller (so company-review/index) or within “Company” controller (so company/reviews/index)?
I should i manage the model search in these two ways?
Thanks