下面是我的Laravel
应用程序的代码:
public function sendNotifications()
{
$matchingSubscriptions = DB::table('tournament_match_plan')
->join('push_subscriptions', 'push_subscriptions.age_group', '=', 'tournament_match_plan.league')
->where('tournament_match_plan.start', '=', '11:20:00')
->where('tournament_match_plan.team_1', '=', 'push_subscriptions.club')
->orwhere('tournament_match_plan.team_2', '=', 'push_subscriptions.club')
->get();
dd($matchingSubscriptions);
}
下面是调试消息:
Illuminate\Support\Collection {#751 ▼ // app\Http\Controllers\Guests\GuestsPushController.php:97
#items: []
#escapeWhenCastingToString: false
}
为什么我的Laravel
代码没有任何结果?
我在phpMyAdmin
中尝试了相同的查询:
SELECT *
FROM tournament_match_plan
JOIN push_subscriptions ON push_subscriptions.age_group = tournament_match_plan.league
WHERE tournament_match_plan.start = '11:20:00'
AND (tournament_match_plan.team_1 = push_subscriptions.club OR tournament_match_plan.team_2 = push_subscriptions.club);
通过上面的代码,我得到了正确的结果。
1条答案
按热度按时间clj7thdc1#
下面是工作代码。