Skip to content

Join Other table #1691

Closed
Closed
@tolgatasci

Description

@tolgatasci
{ 
    "_id" : ObjectId("5c3667e09dc6d6646047a97b"), 
    "name" : "Deep Down", 
    "description" : null, 
    "image" : null, 
    "artist" : null, 
    "musics" : [
        "5c3529e79dc6d63f314976ed", 
        "5c3529e79dc6d63f314976f2", 
        "5c3529e79dc6d63f314976fa", 
        "5c3529e79dc6d63f31497700"
    ], 
    "updated_at" : ISODate("2019-01-09T21:30:08.000+0000"), 
    "created_at" : ISODate("2019-01-09T21:30:08.000+0000")
}

i need musics id get music table info

<?php

namespace App;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;

class Album extends Eloquent
{
    protected $connection = 'mongodb';
    protected $collection = 'tt_albums';

    protected $fillable = [
        'name','image','description','musics','artist'
    ];
    public function musics()
    {
        return $this->hasMany('App\Music','musics','_id');
    }

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions