laravel 使用 eloquent 或查询生成器连接表时,选择所有带有星号的列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25749730/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:04:27 来源:igfitidea点击:
Select all columns with asterix when joining tables with eloquent or query builder
提问by Hobby99
How can I select all columns from one of several joined tables?
如何从多个连接表之一中选择所有列?
DB::table('table as t')->select('t*');
the asterix seems not to work in Laravel? Thank you!
星号似乎在 Laravel 中不起作用?谢谢!
回答by Jarek Tkaczyk
Yes, it works, but you have it wrong. Try this (notice .
):
是的,它有效,但你错了。试试这个(注意.
):
DB::table('table as t')->select('t.*');
回答by Helder Lucas
Try DB::table('table')->get();
尝试 DB::table('table')->get();