Laravel:从多对多关系中选择条件

Elm*_*sry 3 many-to-many laravel

对于帖子和主题,我有一个多对多的 Laravel 关系:

  • 帖子属于许多主题
  • 主题属于许多帖子

我想从某个主题中获取id > 10 的帖子

以下代码将为我获取某个主题的所有帖子:

$topic = Topic::where('id',$topic_id)->get()->first();
$posts= $topic->post;
Run Code Online (Sandbox Code Playgroud)

现在如何获取id > 10 的帖子 ?

楷模:

class Topic extends Eloquent{

    public function post()
    {
     return $this->belongsToMany('post');
        }
    }

class Post extends Eloquent{

    public function topic()
    {
        return $this->belongsToMany('Topic');
    }       
}
Run Code Online (Sandbox Code Playgroud)