jeudi 29 décembre 2016

How to assign relationship and fetch data using array field in laravel

There are two models: Restaurant and Category

Restaurant{
  '_id' : 12345678
  'name' : "xyz",
  'abstract' : "awdwadawdawdawd",
  'category': [1,2,3,4] //category ids
}

Category{
  '_id' : 1,
  'name' : 'PQR'
}

How can I assign relationship and fetch all the categories using that array field (category) of Restaurant in laravel 5.3 and Database is mongodb?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iLnmqZ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire