[英]Using AS Keyword in Laravel Eloquent Join Query In Main Model
I want to use AS
keyword in Laravel Eloquent Model like that: 我想在Laravel Eloquent Model中使用
AS
关键字,例如:
Here my sample query: 这是我的示例查询:
User::find(1)
->select("name", "age")
->join("profile as p", "p.user_id", "=", "users.id")
->orderBy("name", "asc")
->get();
Expected usage u.id
instead of users.id
on joins with main table/model 与主表/模型联接时的预期用法
u.id
而不是users.id
->join("profile as p", "p.user_id", "=", "u.id")
Is there such a feature, is it possible? 有这样的功能吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.