با سلام
در قسمت کنترلر چنین کدی استفاده کرد
$comments = $article->comments()->where('approved', ۱)->where('parent_id', ۰)->latest()->with('comments')->get();
return $comments;
ودر مدل کامنت از چنین کدی
public function comments(){
$this->hasMany(Comment::class , 'parent_id' , 'id')->where('approved' , ۱)->latest();
}
ولی با چنین پیغامی روبرو میشم
Call to a member function addEagerConstraints() on null
لطفا راهنمایی کنید
@ali.bayat
@Alimotreb
@hesammousaviشاید پاسخ شما همینجا باشد