lundi 26 octobre 2015

create list for dropdown with value from relationed table

My model Product return something like this

  • id = 1
  • name = Product Name
  • category_id = 101
  • category = array
    • id = 101
    • name = electronics

and I need to use lists() to create something like this:

lists("category.name", "id")

but it looks that this is impossible. How to create list for dropdown like this:

1 = electronics
2 = furniture
3 = cars
...

thanks a lot



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire