lundi 2 novembre 2020

BelongsToMany Is Not supported for hybrid query constraints - mongodb laravel

I'm getting below error in my laravel application getting belongsToMany relationship data in repository.

$moduleInfo = $this->page->whereHas('section', function ($q) use ($module_id) {
            $q->whereHas('chapters', function ($r) use ($module_id) {
                $r->whereHas('modules', function ($s) use ($module_id) {
                    $s->where('_id', $module_id);
                });
            });
        })
            ->with([
                'section' => function ($q) {
                    $q->with([
                        'chapters' => function ($r) {
                            $r->with('modules');
                        }
                    ]);
                }
            ])
            ->get()
            ->toArray();

in Page Model

public function section()
    {
        return $this->belongsToMany( 'App\Models\Section', 'page_id', 'page_ids' );
    }

I'm using jenssegers/mongodb package to connect mongo DB and laraval version is 5.6 jenssegers/mongodb version is 3.4

Data seems fine. Does anyone know the reason for this issue?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire