query function error

Posted 7 months ago by Kareimovich

I'm getting this error

Undefined property: Illuminate\Database\Eloquent\Relations\BelongsToMany::$tasktags

for

$posts = Path::with(['pathtags' => function ($q) use ($TagArray) { // use $TagArray
    $q->with(['Tasks'=>function($q) use ($TagArray) {
   
        $q->has('tasktags', '=' , 2)->with('tasktags');
            $q->tasktags->whereIn('name', $TagArray)->get();

    }])->with('tasktags');
}])->first();

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.