📜  laravel 原始查询连接多对多 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:01.995000             🧑  作者: Mango

代码示例1
$query = DB::table('blog_posts')
->join('model_names_relations', 'blog_posts.id', '=', 'model_names_relations.blog_post_id')
->join('model_names', 'model_names.id', '=', 'model_names_relations.model_name_id')
->where('blog_posts.id', '12')
->get();