I am trying to implement the feed feature in twitter, that is, I have a query that is returning results from a tbl_a
but I also have a table tbl_b
that contains info of users that I want to promote. Just like twitter does it that in addition to normal tweets from friends we periodically see promoted ads. I really dont know how to implement this feature in laravel any help would be appreciated. The query returning results from tbl_a
is below
我正在尝试在twitter中实现feed功能,也就是说,我有一个返回tbl_a结果的查询,但我还有一个表tbl_b,其中包含我想要提升的用户信息。就像twitter一样,除了来自朋友的普通推文外,我们还定期看到推广广告。我真的不知道如何在laravel中实现此功能任何帮助将不胜感激。从tbl_a返回结果的查询如下
$services = Service::postOnly()
->whereIn('category_id', Auth::user()
->userCats()
->pluck('id'))
->orderBy('created_at', 'desc')
->get();
this is the query i would like to combine with another query from tbl_b, the table that contains the promoted ads.
这是我想要与来自tbl_b的另一个查询结合的查询,tbl_b是包含提升广告的表格。
1 个解决方案
#1
0
have you tried using JOIN statement?
你尝试过使用JOIN语句吗?
https://www.w3schools.com/sql/sql_join.asp
#1
0
have you tried using JOIN statement?
你尝试过使用JOIN语句吗?
https://www.w3schools.com/sql/sql_join.asp