企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
【Laravel Join table】 简单方法: ``` use Illuminate\Support\Facades\DB; $result = DB::table('users') ->join('posts', 'users.tag_id', '=', 'posts.tag') ->select('*') // ->first(); ->limit(1); var_dump($result); ``` ``` // 多对一 public function thumbnail_video() { return $this->belongsTo('App\Thumbnail_video', 'number_id', 'number'); } ``` ``` $media = Media::first(); echo $media->id; echo '<hr/>'; echo $media->thumbnail_video->id; ``` 参考: https://laravel.com/docs/5.5/queries