samedi 19 mars 2016

Eloquent Laravel 5 - Many to many relation with multi column with Mongodb

I use: Laravel mongodb (http://ift.tt/1qxFWF0)

I have table relation in MySQL

table: apps

ID
Name

table: clients

ID
Name

And table relationship: app_client

app_id
client_id
version

field 'version' in table app_client is string type

How to create relational tables in MongoDB as containing the version column?

I create table in Mongodb: table: apps

ID
Name
client_ids => is array: [ObjectID('client_id'), ObjectID('client_id')]

table: clients

ID
Name
app_ids => is array: [ObjectID('app_id'), ObjectID('app_id')]

My Eloquent (Model Client):

public function apps(){
    return $this->belongsToMany('Model\App', null, 'client_ids', 'app_ids');
}

But, not column version Do you know what I mean? How to create column version in database mongodb for Eloquent?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire