A session wouldn't work somehow?
Could you dig into yii and see how they accomplished it?
I save in session while loging user shop_id, and when switching shop I save shop_id in session too. In Yii there is function BeforeSave and BeforeFind in ActiveRecord and I create my own MyActiveRecord : ActiveRecord with beforeSave and BeforeFind method. In this method I add compare to CdbCriteria ($crtiteria->compare('shop_id', $session['shop_id']) and then call parent find.
I need someting like this in Laravel :)
When you say menu, you do mean a menu in the view. If that is the case, could the user shops (other pages) be recorded in the database, then in menu use a dropdown to select a different shop, make links in the dropdown. Or you could have tabbed links at top or bottom of page. Are the shops other pages, or exactly what?
I need to call Product:all() and get only products connected with specific shop (saved in session). Products has shop_id attribute.
Look at this thread:
http://laravel.io/forum/12-12-2014-eloquent-relations-problem
Chaining wheres.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community