PostsHistory 모델에 행이없는 모든 Post (Model : Post)를 반환하려고합니다.Laravel relationship`whereNotIn` 다른 테이블
내 코드는 다음과 같습니다
public function posts(){
return $this->hasMany('App\Post');
}
public function remaining_posts(){
$history = PostHistory::all()->pluck('id');
return $this->posts->whereNotIn('post_id', $history);
}
하지만 오류
[BadMethodCallException]
Method whereNotIn does not exist.
내가 관계를 통해 remaining_posts를 얻을 수 또는 전용 컨트롤러에서 수행 할 수있는 방법이 있나요 얻을?
설명해 주셔서 감사합니다 :) – George