首页
\
问答
\
具有回退到闭包的此查询的等效Eloquent版本是什么?(What would be the equivalent Eloquent version of this query with fallback to closure?)
具有回退到闭包的此查询的等效Eloquent版本是什么?(What would be the equivalent Eloquent version of this query with fallback to closure?)
这是一个示例查询。 这是针对MySQL的。
select sub_query.corporations_owned_id, corporations_owned.corp_name, sub_query.counts from corporations_owned INNER JOIN ( select corporations_owned_id, COUNT(user_id) as counts from corporations_owned_user group by corporations_owned_id ) as sub_query on sub_query.corporations_owned_id = corporations_owned.corp_id where corp_status = 1
我想要做的是:
DB::table('corporations_owned') -> select (DB::raw("sub_query.corporations_owned_id, corporations_owned.corp_name, sub_query.counts")) -> join ($query, callback_function () { //what should be the equivalent closure here? }) // rest of the query;
我对回调函数的期望是:
-> join ($query, function($query) { $query -> //Another query in eloquent format only, but not in raw. "select corporations_owned_id, COUNT(user_id) as counts from corporations_owned_user group by corporations_owned_id" })
我想在eloquent中添加一个对join函数的回调,正如我在上面的例子中所示。 我需要做出哪些改变?
This is a example query. This is for MySQL.
select sub_query.corporations_owned_id, corporations_owned.corp_name, sub_query.counts from corporations_owned INNER JOIN ( select corporations_owned_id, COUNT(user_id) as counts from corporations_owned_user group by corporations_owned_id ) as sub_query on sub_query.corporations_owned_id = corporations_owned.corp_id where corp_status = 1
What I would like is to do is:
DB::table('corporations_owned') -> select (DB::raw("sub_query.corporations_owned_id, corporations_owned.corp_name, sub_query.counts")) -> join ($query, callback_function () { //what should be the equivalent closure here? }) // rest of the query;
My expectancy for the callback function is:
-> join ($query, function($query) { $query -> //Another query in eloquent format only, but not in raw. "select corporations_owned_id, COUNT(user_id) as counts from corporations_owned_user group by corporations_owned_id" })
I would like to add a callback to the join function in eloquent as I have shown in the above example. What changes to I need to make?
原文:https://stackoverflow.com/questions/39337093
更新时间:2022-04-20 12:04
最满意答案
由于没有为图像设置源(src),所以它显示白色边框。
As there is no source(src) set for image so its displaying white border.
相关问答
更多-
图片在Chrome中拉伸(images stretched in Chrome)[2022-03-06]
不要同时使用两者。 只使用width="80%" 。 不知道细节为什么会发生这种情况,但这样可以解决您的问题(除非您有意使用垂直拉伸有意扭曲图像)。 Do not use both. Use only width="80%". Don't know details why it acts like it does, but that will fix your problem (unless you intentionally want to distort your image a bit using v ... -
这看起来是Chrome中的一个已知错误我害怕。 它主要与转换有关,以及在转换期间绘制DOM时父/子的顺序如何变为: https://code.google.com/p/chromium/issues/detail?id=157218 作为替代方案,您可以使包括边框和阴影在内的整个圆圈的大小增加。 但是我认为这不是你想要的效果。 另请参阅Stack Overflow上的这个主题: Bug with transform:scale and overflow:隐藏在Chrome中 This looks to be ...
-
由于无法在标签中加载页面,因此无法获取页面的屏幕截图,因此Chrome浏览您喜欢的网站时只是获取这些屏幕截图 。 您可以轻松地说出这一点,因为有时网站和图片不一致(例如,有时我的facebook.com顶级网站有我的个人资料页面的图像,但链接到家庭)。 然后,如果您需要顶级网站的屏幕截图,则必须在没有屏幕截图的情况下启动,并在用户浏览网页时创建它们,方法是使用chrome.tabs API检查标签何时加载其中一个热门网站(收听到onUpdated事件),并使用captureVisibleTab获取该选项卡的 ...
-
您的HTML代码格式不正确。 缺少Doctype以及其他一些小错误。 试一试。 在CSS中,float不能是'cneter'。 这是'正确'或'左'。 最后,在你的css中,'font-size'的值为px。 你应该有一个有效的值,例如'13px'。
Insert title here ... -
Chrome的边框问题(Border bottom issue with Chrome)[2022-07-27]
你必须使用border-width: 0 0 5px; 而不是border-bottom-width: 5px; 。 在这里检查小提琴。 You have to use border-width: 0 0 5px; instead of border-bottom-width: 5px;. Check Fiddle Here. -
由于没有为图像设置源(src),所以它显示白色边框。 As there is no source(src) set for image so its displaying white border.
-
尝试在thead之后放置tbody 。 HTML