I have products table like this.
id direction_id
______________________
1 1
2 2
3 2
4 2
5 1
6 3
I need to get one random product of all directions.
E.G.
Direction 1 - Product(1 or 5)
Direction 2 - Product(2 or 3 or 4)
Direction 3 - Product(6)
And i need to use Product model because I have a lot of relationships which i should use.
Thanks in advance!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire