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.

 message    "BelongsToMany Is Not supported for hybrid query constraints!"
    exception   "Exception"
    file    "/var/www/backend/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Helpers/QueriesRelationships.php"
    line    115

Repository code is like below.

$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?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/35YmedN
via IFTTT

Aucun commentaire:

Enregistrer un commentaire