Laravel 5.5 Model 查询字段

查询所有数据
Post::all(['title']);
Post::all(['id','title','subtitle','published_at']);
查询id = 1 的title
Post::where('id',1)->get(['title']);
Post::find(1, ['id', 'title','subtitle']);
Post::get(['id', 'title','subtitle']);
发布了29 篇原创文章 · 获赞 5 · 访问量 7977

猜你喜欢

转载自blog.csdn.net/qq_25194685/article/details/105019038