Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

A session wouldn't work somehow?
Could you dig into yii and see how they accomplished it?

Last updated 9 years ago.
0

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 :)

0

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?

0

I need to call Product:all() and get only products connected with specific shop (saved in session). Products has shop_id attribute.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

kpyrdol kpyrdol Joined 11 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.